libcli: Update error check for new string conversion wrapper
authorSwen Schillig <swen@linux.ibm.com>
Wed, 6 Mar 2019 09:06:35 +0000 (10:06 +0100)
committerChristof Schmitt <cs@samba.org>
Thu, 11 Apr 2019 22:29:27 +0000 (22:29 +0000)
The new string conversion wrappers detect and flag errors
which occured during the string to integer conversion.
Those modifications required an update of the callees
error checks.

Signed-off-by: Swen Schillig <swen@linux.ibm.com>
Reviewed-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Christof Schmitt <cs@samba.org>
libcli/security/dom_sid.c

index ca7fd874752f0a342bbe9c3b63bf0dcc2438a0af..ac34a92f19c99e7e7c3cb4503f6dda37027b6db4 100644 (file)
@@ -149,7 +149,7 @@ bool dom_sid_parse_endp(const char *sidstr,struct dom_sid *sidout,
        }
 
        conv = strtoul_err(p, &q, 10, &error);
-       if (!q || (*q != '-') || conv > UINT8_MAX || error != 0) {
+       if (error != 0 || (*q != '-') || conv > UINT8_MAX) {
                goto format_error;
        }
        sidout->sid_rev_num = (uint8_t) conv;
@@ -161,7 +161,7 @@ bool dom_sid_parse_endp(const char *sidstr,struct dom_sid *sidout,
 
        /* get identauth */
        conv = strtoull_err(q, &q, 0, &error);
-       if (!q || conv & AUTHORITY_MASK || error != 0) {
+       if (conv & AUTHORITY_MASK || error != 0) {
                goto format_error;
        }
 
@@ -190,7 +190,7 @@ bool dom_sid_parse_endp(const char *sidstr,struct dom_sid *sidout,
                }
 
                conv = strtoull_err(q, &end, 10, &error);
-               if (end == q || conv > UINT32_MAX || error != 0) {
+               if (conv > UINT32_MAX || error != 0) {
                        goto format_error;
                }