]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
libsmb: Protect cli_RNetServerEnum against rprcnt<6
authorVolker Lendecke <vl@samba.org>
Sat, 2 May 2020 13:10:14 +0000 (15:10 +0200)
committerAndreas Schneider <asn@cryptomilk.org>
Tue, 5 May 2020 15:35:35 +0000 (15:35 +0000)
Bug: https://bugzilla.samba.org/show_bug.cgi?id=14362
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
source3/libsmb/clirap.c

index 1b4734ae919336eac376806cb9d1349c0e2db6a4..3f6711cd236d68e19ba5fcdc0ba7b0152b24f1de 100644 (file)
@@ -305,6 +305,13 @@ bool cli_NetServerEnum(struct cli_state *cli, char *workgroup, uint32_t stype,
                }
 
                rdata_end = rdata + rdrcnt;
+
+               if (rprcnt < 6) {
+                       DBG_ERR("Got invalid result: rprcnt=%u\n", rprcnt);
+                       res = -1;
+                       break;
+               }
+
                res = rparam ? SVAL(rparam,0) : -1;
 
                if (res == 0 || res == ERRmoredata ||