Don't bomb out when trying to unmarshall a zero length printerdata value.
authorTim Potter <tpot@samba.org>
Mon, 14 Jul 2003 05:13:30 +0000 (05:13 +0000)
committerTim Potter <tpot@samba.org>
Mon, 14 Jul 2003 05:13:30 +0000 (05:13 +0000)
Fixes remote printer publishing of shared printers from a Samba server.

source/rpc_parse/parse_spoolss.c

index 03b204e69d4b1674d24213178586cb5cfd8c34a1..1a380c64d556502c9f48cc4be0caa5ebf93169f1 100644 (file)
@@ -7296,15 +7296,14 @@ static BOOL spoolss_io_printer_enum_values_ctr(const char *desc, prs_struct *ps,
                if (!prs_unistr("valuename", ps, depth, &ctr->values[i].valuename))
                        return False;
                
-               if (UNMARSHALLING(ps)) {
+               if (UNMARSHALLING(ps) && ctr->values[i].data_len) {
                        ctr->values[i].data = (uint8 *)prs_alloc_mem(
                                ps, ctr->values[i].data_len);
                        if (!ctr->values[i].data)
                                return False;
+                       if (!prs_uint8s(False, "data", ps, depth, ctr->values[i].data, ctr->values[i].data_len))
+                               return False;
                }
-
-               if (!prs_uint8s(False, "data", ps, depth, ctr->values[i].data, ctr->values[i].data_len))
-                       return False;
                        
                if ( !prs_align_uint16(ps) )
                        return False;