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

s3: avoid reading past the end of buffer in tdb_unpack 'f' if zero termination is missing

Signed-off-by: Michael Adam <obnox@samba.org>
This commit is contained in:
Gregor Beck 2011-07-05 11:55:34 +02:00 committed by Michael Adam
parent 39f9c854ae
commit 8a36e72140

View File

@ -417,7 +417,7 @@ int tdb_unpack(const uint8 *buf, int bufsize, const char *fmt, ...)
break; break;
case 'f': /* null-terminated string */ case 'f': /* null-terminated string */
s = va_arg(ap,char *); s = va_arg(ap,char *);
len = strlen((const char *)buf) + 1; len = strnlen((const char *)buf, bufsize) + 1;
if (bufsize < len || len > sizeof(fstring)) if (bufsize < len || len > sizeof(fstring))
goto no_space; goto no_space;
memcpy(s, buf, len); memcpy(s, buf, len);