From: Lin Liu Date: Tue, 18 Nov 2025 05:50:55 +0000 (+0000) Subject: tdb: Fix parse_hex during `tdbtool storehex` X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ba7f4b1167471cea56f069972f78541b76b58657;p=thirdparty%2Fsamba.git tdb: Fix parse_hex during `tdbtool storehex` Fixes: fd0561279 During `tdbtool storehex`, tdbtool check whether the input string in hex format. However, during the check, the index is never moved forward, resulting in checking beyond the valid input string. This patch fix the issue by checking the valid string Signed-off-by: Lin Liu Reviewed-by: Jennifer Sutton Reviewed-by: Andreas Schneider Autobuild-User(master): Jennifer Sutton Autobuild-Date(master): Thu Nov 20 22:29:03 UTC 2025 on atb-devel-224 --- diff --git a/lib/tdb/tools/tdbtool.c b/lib/tdb/tools/tdbtool.c index ecd1bb9b50b..6fcadcaa0f5 100644 --- a/lib/tdb/tools/tdbtool.c +++ b/lib/tdb/tools/tdbtool.c @@ -363,13 +363,13 @@ static int store_tdb(char *keyname, size_t keylen, char* data, size_t datalen) static bool parse_hex(const char *src, size_t srclen, uint8_t *dst) { - size_t i=0; + const char *end = src + srclen; if ((srclen % 2) != 0) { return false; } - while (i