From: eaglegai Date: Thu, 28 Oct 2021 13:51:13 +0000 (+0800) Subject: fix undefined-shift in put_res_rec fuzz error: ../../source3/libsmb/nmblib.c:451... X-Git-Tag: ldb-2.5.0~332 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=14f56750fcf51a1d6daa14da08b34eb789241a23;p=thirdparty%2Fsamba.git fix undefined-shift in put_res_rec fuzz error: ../../source3/libsmb/nmblib.c:451:4: runtime error: left shift of 65312 by 16 places cannot be represented in type 'int' Author: eaglegai Signed-off-by: eaglegai Reviewed-by: Jeremy Allison Reviewed-by: Douglas Bagnall Autobuild-User(master): Jeremy Allison Autobuild-Date(master): Fri Oct 29 20:29:26 UTC 2021 on sn-devel-184 --- diff --git a/source3/libsmb/nmblib.c b/source3/libsmb/nmblib.c index ff009092bbf..607470f7e4e 100644 --- a/source3/libsmb/nmblib.c +++ b/source3/libsmb/nmblib.c @@ -449,7 +449,7 @@ static int put_res_rec(char *buf, size_t buflen, int offset,struct res_rec *recs if (buf) { RSSVAL(buf,offset,recs[i].rr_type); RSSVAL(buf,offset+2,recs[i].rr_class); - RSIVAL(buf,offset+4,recs[i].ttl); + RSIVAL(buf,offset+4,(unsigned int)recs[i].ttl); RSSVAL(buf,offset+8,recs[i].rdlength); memcpy(buf+offset+10,recs[i].rdata,recs[i].rdlength); }