Fix static analysis issue 49/218249/2
authorInkyun Kil <inkyun.kil@samsung.com>
Thu, 21 Nov 2019 00:29:33 +0000 (09:29 +0900)
committerInkyun Kil <inkyun.kil@samsung.com>
Thu, 21 Nov 2019 00:33:49 +0000 (09:33 +0900)
Change-Id: Id09fa513a35be23af3049f9c499077939f54ab08

src/keyval_array.c

index a9087c5..6dddc35 100644 (file)
@@ -207,6 +207,9 @@ int keyval_array_set_element(keyval_array_t *kva, int idx, void *val, size_t siz
        keyval_t *kv = (keyval_t *)kva;
        char *str;
 
+       if (size <= 0)
+               return BUNDLE_ERROR_INVALID_PARAMETER;
+
        /* An element is already exist in the idx! */
        if (kva->array_val[idx]) {
                /* val==NULL means 'Free this element!' */