printing: Fix CID 1435452 (TAINTED_SCALAR)
authorVolker Lendecke <vl@samba.org>
Tue, 8 May 2018 06:41:04 +0000 (08:41 +0200)
committerJeremy Allison <jra@samba.org>
Fri, 11 May 2018 18:33:13 +0000 (20:33 +0200)
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ira Cooper <ira@samba.org>
source3/printing/nt_printing.c

index 395f7b87da624d0572d79c2cabde128aba6179f5..1639bfd440661e91a8d93d2519d6724e68d0104c 100644 (file)
@@ -390,6 +390,12 @@ static int handle_pe_file(files_struct *fsp,
 
        /* get the section table */
        num_sections        = SVAL(buf,PE_HEADER_NUMBER_OF_SECTIONS);
+
+       if (num_sections >= (UINT_MAX / PE_HEADER_SECT_HEADER_SIZE)) {
+               /* Integer wrap. */
+               goto out;
+       }
+
        section_table_bytes = num_sections * PE_HEADER_SECT_HEADER_SIZE;
        if (section_table_bytes == 0) {
                goto out;