From: Swen Schillig Date: Wed, 6 Mar 2019 09:06:35 +0000 (+0100) Subject: libcli: Update error check for new string conversion wrapper X-Git-Tag: tdb-1.4.1~450 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=beb3012e3f9ebf5dceb1cc1db4f9f34e22bc8286;p=thirdparty%2Fsamba.git libcli: Update error check for new string conversion wrapper 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 Reviewed-by: Ralph Boehme Reviewed-by: Christof Schmitt --- diff --git a/libcli/security/dom_sid.c b/libcli/security/dom_sid.c index ca7fd874752..ac34a92f19c 100644 --- a/libcli/security/dom_sid.c +++ b/libcli/security/dom_sid.c @@ -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; }