1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-26 21:57:41 +03:00

libcli/security: allow round-trip for conditional ACE hex integers

As with the previous commit, though not addressing the particular fuzz
case, zero hex numbers need to be explicitly written as "0x0", or the
round-trip will fail.

Credit to OSS-Fuzz.

REF: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=62929

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
Douglas Bagnall 2023-12-13 17:24:50 +13:00 committed by Andrew Bartlett
parent d33ed63147
commit 66f341e5c3

@ -639,7 +639,7 @@ static bool sddl_write_int(struct sddl_write_context *ctx,
} else if (base == CONDITIONAL_ACE_INT_BASE_10) {
snprintf(buf, sizeof(buf), "%"PRId64, v);
} else {
snprintf(buf, sizeof(buf), "%#"PRIx64, v);
snprintf(buf, sizeof(buf), "0x%"PRIx64, v);
}
return sddl_write(ctx, buf);
}
@ -675,7 +675,7 @@ static bool sddl_write_int(struct sddl_write_context *ctx,
if (base == CONDITIONAL_ACE_INT_BASE_8) {
snprintf(buf + 1, sizeof(buf) - 1, "0%llo", llabs(v));
} else {
snprintf(buf + 1, sizeof(buf) - 1, "%#llx", llabs(v));
snprintf(buf + 1, sizeof(buf) - 1, "0x%llx", llabs(v));
}
return sddl_write(ctx, buf);
}