summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2011-10-18 18:03:10 +0200
committerMichael Adam <obnox@samba.org>2011-10-18 20:58:26 +0200
commit5d91a2680e594d47ed137b45f79738bddb641cea (patch)
treeab569d0ffb818c5dc18e9b40e91b62e8a096122b
parent196fd147888efec3e1f79efd1e54f5a99e3dd544 (diff)
downloadsamba-5d91a2680e594d47ed137b45f79738bddb641cea.tar.gz
samba-5d91a2680e594d47ed137b45f79738bddb641cea.tar.bz2
samba-5d91a2680e594d47ed137b45f79738bddb641cea.zip
lib/util: untangle assignent from check in strhex_to_str()
-rw-r--r--lib/util/util.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/util/util.c b/lib/util/util.c
index b700f372c7..c5ed6fd0c7 100644
--- a/lib/util/util.c
+++ b/lib/util/util.c
@@ -712,13 +712,17 @@ _PUBLIC_ size_t strhex_to_str(char *p, size_t p_len, const char *strhex, size_t
}
for (; i < strhex_len && strhex[i] != 0; i++) {
- if (!(p1 = strchr(hexchars, toupper((unsigned char)strhex[i]))))
+ p1 = strchr(hexchars, toupper((unsigned char)strhex[i]));
+ if (p1 == NULL) {
break;
+ }
i++; /* next hex digit */
- if (!(p2 = strchr(hexchars, toupper((unsigned char)strhex[i]))))
+ p2 = strchr(hexchars, toupper((unsigned char)strhex[i]));
+ if (p2 == NULL) {
break;
+ }
/* get the two nybbles */
hinybble = PTR_DIFF(p1, hexchars);