1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-02 09:47:23 +03:00

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

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

View File

@ -410,7 +410,9 @@ int tdb_unpack(const uint8 *buf, int bufsize, const char *fmt, ...)
case 'P': /* null-terminated string */
/* Return malloc'ed string. */
ps = va_arg(ap,char **);
len = strlen((const char *)buf) + 1;
len = strnlen((const char *)buf, bufsize) + 1;
if (bufsize < len)
goto no_space;
*ps = SMB_STRDUP((const char *)buf);
break;
case 'f': /* null-terminated string */