Fix svace 87/253187/3 accepted/tizen/unified/20210223.065526 submit/tizen/20210222.042310
authorlokilee73 <changjoo.lee@samsung.com>
Fri, 5 Feb 2021 08:35:15 +0000 (17:35 +0900)
committerlokilee73 <changjoo.lee@samsung.com>
Mon, 8 Feb 2021 11:20:22 +0000 (20:20 +0900)
Change-Id: I5397a386b95ed5fbaccda82a02a2b70026766044
Signed-off-by: lokilee73 <changjoo.lee@samsung.com>
src/libcommon/ini-parser.c

index 11093cc..f3ed8c7 100644 (file)
@@ -36,10 +36,13 @@ static inline char *trim_str(char *s)
        s += strspn(s, WHITESPACE);
 
        /* right trim */
-       for (t = strchr(s, 0); t > s; t--)
+       for (t = strchr(s, 0); (t != NULL) && (t > s); t--)
                if (!strchr(WHITESPACE, t[-1]))
                        break;
-       *t = 0;
+
+       if (t)
+               *t = 0;
+
        return s;
 }