Loading...
libkern/c++/OSUnserializeXML.cpp xnu-517.7.21 xnu-792.1.5
--- xnu/xnu-517.7.21/libkern/c++/OSUnserializeXML.cpp
+++ xnu/xnu-792.1.5/libkern/c++/OSUnserializeXML.cpp
@@ -1410,9 +1410,8 @@
 {
 	unsigned long long n = 0;
 	int base = 10;
+	bool negate = false;
 	int c = currentChar();
-
-	if (!isDigit (c)) return 0;
 
 	if (c == '0') {
 		c = nextChar();
@@ -1422,9 +1421,16 @@
 		}
 	}
 	if (base == 10) {
+		if (c == '-') {
+			negate = true;
+			c = nextChar();
+		}
 		while(isDigit(c)) {
 			n = (n * base + c - '0');
 			c = nextChar();
+		}
+		if (negate) {
+			n = (unsigned long long)((long long)n * (long long)-1);
 		}
 	} else {
 		while(isHexDigit(c)) {