[SATIZENVUL-1600] Fix overflow in malloc 93/188393/1 accepted/tizen/unified/20180905.060849 submit/tizen/20180904.232123
authorSeonah Moon <seonah1.moon@samsung.com>
Tue, 4 Sep 2018 11:01:32 +0000 (20:01 +0900)
committerSeonah Moon <seonah1.moon@samsung.com>
Tue, 4 Sep 2018 11:01:37 +0000 (20:01 +0900)
Change-Id: I16d50d9c586dc6df1b5713a844a29beaf1d96559

src/http_common.c

index 5751b6d..34ace4d 100644 (file)
@@ -287,6 +287,9 @@ gchar* parse_values(const gchar* string, int from_index, int to_index)
        gchar* str = NULL;
        int cur_index = to_index - from_index;
 
+       if (to_index < from_index)
+               return NULL;
+
        str = (gchar*) malloc(cur_index + 1);
        if (str) {
                memset(str, '\0', cur_index + 1);