summaryrefslogtreecommitdiffstats
path: root/src/core/misc.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/misc.c')
-rw-r--r--src/core/misc.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/core/misc.c b/src/core/misc.c
index 968e232d4..2a9263138 100644
--- a/src/core/misc.c
+++ b/src/core/misc.c
@@ -155,11 +155,14 @@ unsigned long strtoul ( const char *p, char **endp, int base ) {
unsigned int charval;
if ( base == 0 ) {
- if ( ( p[0] == '0' ) && ( ( p[1] | 0x20 ) == 'x' ) ) {
- base = 16;
- p += 2;
- } else {
- base = 10;
+ base = 10;
+ if ( *p == '0' ) {
+ p++;
+ base = 8;
+ if ( ( *p | 0x20 ) == 'x' ) {
+ p++;
+ base = 16;
+ }
}
}