[no patch]: source3/utils/regedit_valuelist.c

Christopher R. Hertel crh at ubiqx.mn.org
Thu Feb 13 14:18:50 MST 2014


So... looking at a Coverity defect, I see an obvious but only partial fix:

--- a/source3/utils/regedit_valuelist.c
+++ b/source3/utils/regedit_valuelist.c
@@ -169,7 +169,7 @@ static bool string_is_printable(const char *s)

 static WERROR append_data_summary(struct value_item *vitem)
 {
-       char *tmp;
+       char *tmp = NULL;

 /* This is adapted from print_registry_value() in net_registry_util.c */


Initializing the variable <tmp> to NULL is needed, because there are two
instances in which we can break out of the switch() statement without
setting any value to <tmp>.

                if (!pull_reg_sz(vitem, &vitem->data, &s)) {
                        break;
                }

and

                if (!pull_reg_multi_sz(vitem, &vitem->data, &a)) {
                        break;
                }


However, at the end of the function, we have:

        if (tmp == NULL) {
                return WERR_NOMEM;
        }

So the problem is this:  What error value *should* be returned if either
pull_reg_sz() or pull_reg_multi_sz() fail?  WERR_NOMEM seems like the wrong
result in those cases.

Chris -)-----

PS.  My e'mail provider has suffered a catastrophic power-surge motherboard
     of a blowout.  As a result, I am not currently receiving incoming
     e'mail.  I'm watching the samba-technical archives for responses.

-- 
"Implementing CIFS - the Common Internet FileSystem" ISBN: 013047116X
Samba Team -- http://www.samba.org/     -)-----   Christopher R. Hertel
jCIFS Team -- http://jcifs.samba.org/   -)-----   ubiqx development, uninq.
ubiqx Team -- http://www.ubiqx.org/     -)-----   crh at ubiqx.mn.org
OnLineBook -- http://ubiqx.org/cifs/    -)-----   crh at ubiqx.org


More information about the samba-technical mailing list