[alsa-devel] [PATCH - UCM 1/2] control: enable octal and hexadecimal parse

han.lu at intel.com han.lu at intel.com
Wed Jan 14 02:08:30 CET 2015


From: "Lu, Han" <han.lu at intel.com>

Use zero-base for strtol(), so get_integer() and get_integer64()
can parse decimal, octal and hexadecimal data from input string.

Signed-off-by: Lu, Han <han.lu at intel.com>

diff --git a/src/control/ctlparse.c b/src/control/ctlparse.c
index 978977d..8d6c385 100644
--- a/src/control/ctlparse.c
+++ b/src/control/ctlparse.c
@@ -59,7 +59,7 @@ static long get_integer(const char **ptr, long min, long max)
 		goto out;
 
 	s = p;
-	val = strtol(s, &p, 10);
+	val = strtol(s, &p, 0);
 	if (*p == '.') {
 		p++;
 		strtol(p, &p, 10);
@@ -87,7 +87,7 @@ static long long get_integer64(const char **ptr, long long min, long long max)
 		goto out;
 
 	s = p;
-	val = strtol(s, &p, 10);
+	val = strtol(s, &p, 0);
 	if (*p == '.') {
 		p++;
 		strtol(p, &p, 10);
-- 
1.9.1



More information about the Alsa-devel mailing list