samba/backport-fix-undefined-shift-in-put_res_rec.patch

36 lines
1.3 KiB
Diff
Raw Normal View History

2021-11-05 15:40:22 +08:00
From 14f56750fcf51a1d6daa14da08b34eb789241a23 Mon Sep 17 00:00:00 2001
From: eaglegai <eaglegai@163.com>
Date: Thu, 28 Oct 2021 21:51:13 +0800
Subject: [PATCH] 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 <eaglegai@163.com>
Signed-off-by: eaglegai <eaglegai@163.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Fri Oct 29 20:29:26 UTC 2021 on sn-devel-184
---
source3/libsmb/nmblib.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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);
}
--
GitLab