summaryrefslogtreecommitdiffstats
path: root/src/core/misc.c
diff options
context:
space:
mode:
authorMichael Brown2006-11-15 03:54:28 +0100
committerMichael Brown2006-11-15 03:54:28 +0100
commitbbfb2e02fd5522df7acd537dc0b9e80f022f1f96 (patch)
tree63bedf39f59db4ad38d54ced37a0ca1d696cb844 /src/core/misc.c
parentExtend strtoul() to cope with hex as well as decimal. Doesn't cope (diff)
downloadipxe-bbfb2e02fd5522df7acd537dc0b9e80f022f1f96.tar.gz
ipxe-bbfb2e02fd5522df7acd537dc0b9e80f022f1f96.tar.xz
ipxe-bbfb2e02fd5522df7acd537dc0b9e80f022f1f96.zip
Fixed endp bug in strtoul()
Diffstat (limited to 'src/core/misc.c')
-rw-r--r--src/core/misc.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/core/misc.c b/src/core/misc.c
index 2765f7dc..968e232d 100644
--- a/src/core/misc.c
+++ b/src/core/misc.c
@@ -164,7 +164,7 @@ unsigned long strtoul ( const char *p, char **endp, int base ) {
}
while ( 1 ) {
- charval = *(p++) - '0';
+ charval = ( *p - '0' );
if ( charval > ( 'A' - '0' - 10 ) )
charval -= ( 'A' - '0' - 10 );
if ( charval > ( 'a' - 'A' ) )
@@ -172,6 +172,7 @@ unsigned long strtoul ( const char *p, char **endp, int base ) {
if ( charval >= ( unsigned int ) base )
break;
ret = ( ( ret * base ) + charval );
+ p++;
}
if ( endp )