From: Volker Lendecke Date: Sat, 2 May 2020 12:59:07 +0000 (+0200) Subject: libsmb: Protect cli_RNetShareEnum() against rprcnt<6 X-Git-Tag: samba-4.11.10~17 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=39a3d728a605b02d209b39ee764de5bd4d4501fc;p=thirdparty%2Fsamba.git libsmb: Protect cli_RNetShareEnum() against rprcnt<6 Bug: https://bugzilla.samba.org/show_bug.cgi?id=14366 Signed-off-by: Volker Lendecke Reviewed-by: Andreas Schneider (cherry picked from commit 4a9fe4efefa67d6f24efcbe29722a43fc4859fdc) --- diff --git a/source3/libsmb/clirap.c b/source3/libsmb/clirap.c index a703f453556..9b7f54c503b 100644 --- a/source3/libsmb/clirap.c +++ b/source3/libsmb/clirap.c @@ -204,6 +204,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) {