]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
libsmb: Protect cli_RNetShareEnum() against rprcnt<6
authorVolker Lendecke <vl@samba.org>
Sat, 2 May 2020 12:59:07 +0000 (14:59 +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 f1e7f2488a55221682de5cbdc152e1269f8f7b57..1b4734ae919336eac376806cb9d1349c0e2db6a4 100644 (file)
@@ -137,6 +137,11 @@ int cli_RNetShareEnum(struct cli_state *cli, void (*fn)(const char *, uint32_t,
                goto done;
        }
 
+       if (rprcnt < 6) {
+               DBG_ERR("Got invalid result: rprcnt=%u\n", rprcnt);
+               goto done;
+       }
+
        res = rparam? SVAL(rparam,0) : -1;
 
        if (res == 0 || res == ERRmoredata) {