Fixed a buffer underflow which could happen during processing sdb shell command. 88/89388/1
authorshingil.kang <shingil.kang@samsung.com>
Fri, 23 Sep 2016 08:50:37 +0000 (17:50 +0900)
committershingil.kang <shingil.kang@samsung.com>
Fri, 23 Sep 2016 08:55:49 +0000 (17:55 +0900)
Change-Id: I0faa48855632d00e18b9e054b4f83e786b24bdd9
Signed-off-by: shingil.kang <shingil.kang@samsung.com>
src/services.c

index 2fbcaa797fe52798a7de63415a0bb951ee0549e3..64cc80b0af069479efe1f62e4550c37edfe6a709 100644 (file)
@@ -563,7 +563,7 @@ static void get_env(char *key, char **env)
         e = buf + (strlen(buf) - 1);
 
         // trim string
-        while(*e == ' ' ||  *e == '\n' || *e == '\t') {
+        while( (e > s) && (*e == ' ' ||  *e == '\n' || *e == '\t')) {
             e--;
         }
         *(e+1) ='\0';