1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-22 22:04:08 +03:00

lib: Use talloc_asprintf_addbufin _ber_read_OID_String_impl

Just one NULL check required

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
Volker Lendecke 2024-05-23 16:06:37 +02:00
parent 4313add2bf
commit 0321f31a8e

View File

@ -778,7 +778,6 @@ static bool _ber_read_OID_String_impl(TALLOC_CTX *mem_ctx, DATA_BLOB blob,
b = blob.data;
tmp_oid = talloc_asprintf(mem_ctx, "%u.%u", b[0]/40, b[0]%40);
if (!tmp_oid) goto nomem;
if (bytes_eaten != NULL) {
*bytes_eaten = 0;
@ -787,12 +786,15 @@ static bool _ber_read_OID_String_impl(TALLOC_CTX *mem_ctx, DATA_BLOB blob,
for(i = 1, v = 0; i < blob.length; i++) {
v = (v<<7) | (b[i]&0x7f);
if ( ! (b[i] & 0x80)) {
tmp_oid = talloc_asprintf_append_buffer(tmp_oid, ".%u", v);
talloc_asprintf_addbuf(&tmp_oid, ".%u", v);
v = 0;
if (bytes_eaten)
*bytes_eaten = i+1;
}
if (!tmp_oid) goto nomem;
}
if (tmp_oid == NULL) {
goto nomem;
}
*OID = tmp_oid;