[PATCH v3 2/2] staging: speakup: fix a bug when translate octal numbers

Andy Shevchenko andriy.shevchenko at linux.intel.com
Tue Apr 9 12:22:16 UTC 2013


There are actually overflow bug and typo. And bug was never happened due to the
typo.

Signed-off-by: Andy Shevchenko <andriy.shevchenko at linux.intel.com>
---
 drivers/staging/speakup/varhandlers.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/speakup/varhandlers.c b/drivers/staging/speakup/varhandlers.c
index b1c155b..45dc9b9 100644
--- a/drivers/staging/speakup/varhandlers.c
+++ b/drivers/staging/speakup/varhandlers.c
@@ -344,9 +344,9 @@ char *spk_xlate(char *s)
 			p1++;
 		} else if (*p1 >= '0' && *p1 <= '7') {
 			num = (*p1++)&7;
-			while (num < 256 && *p1 >= '0' && *p1 <= '7') {
+			while (num < 32 && *p1 >= '0' && *p1 <= '7') {
 				num <<= 3;
-				num = (*p1++)&7;
+				num += (*p1++)&7;
 			}
 			*p++ = num;
 		} else if (*p1 == 'x' && !hex2bin(&num, p1 + 1, 1)) {
-- 
1.8.2.rc0.22.gb3600c3




More information about the devel mailing list