projects
/
freeradius.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
970e811
)
The fewer magic numbers the better...
author
Arran Cudbard-Bell
<a.cudbardb@freeradius.org>
Fri, 13 Jun 2014 15:37:54 +0000
(16:37 +0100)
committer
Arran Cudbard-Bell
<a.cudbardb@freeradius.org>
Fri, 13 Jun 2014 15:40:16 +0000
(16:40 +0100)
src/lib/misc.c
patch
|
blob
|
history
diff --git
a/src/lib/misc.c
b/src/lib/misc.c
index
2bf11c2
..
abe5c90
100644
(file)
--- a/
src/lib/misc.c
+++ b/
src/lib/misc.c
@@
-1015,8
+1015,8
@@
size_t fr_hex2bin(uint8_t *bin, size_t outlen, char const *hex, size_t inlen)
if (len > outlen) len = outlen;
for (i = 0; i < len; i++) {
- if(!(c1 = memchr(hextab, tolower((int) hex[i << 1]),
16
)) ||
- !(c2 = memchr(hextab, tolower((int) hex[(i << 1) + 1]),
16
)))
+ if(!(c1 = memchr(hextab, tolower((int) hex[i << 1]),
sizeof(hextab)
)) ||
+ !(c2 = memchr(hextab, tolower((int) hex[(i << 1) + 1]),
sizeof(hextab)
)))
break;
bin[i] = ((c1-hextab)<<4) + (c2-hextab);
}