usb : initialize n_configs and limits configs value 31/126331/1 accepted/tizen/4.0/unified/20170816.013028 accepted/tizen/4.0/unified/20170828.224241 accepted/tizen/unified/20170421.114451 submit/tizen/20170421.042748 submit/tizen_4.0/20170811.094300 submit/tizen_4.0/20170828.110001 tizen_4.0.m1_release
authorlokilee73 <changjoo.lee@samsung.com>
Fri, 21 Apr 2017 04:07:03 +0000 (13:07 +0900)
committerlokilee73 <changjoo.lee@samsung.com>
Fri, 21 Apr 2017 04:07:09 +0000 (13:07 +0900)
Change-Id: I9e21eb8fdc2ddd0d8f9ce0f1f6a753cffec27798
Signed-off-by: lokilee73 <changjoo.lee@samsung.com>
hw/usb_gadget/usb_gadget.c [changed mode: 0644->0755]

old mode 100644 (file)
new mode 100755 (executable)
index 0bcb10b..fcf144c
@@ -185,7 +185,7 @@ static int simple_id_to_gadget(struct usb_gadget_id *gadget_id,
                               struct usb_gadget **_gadget)
 {
        struct usb_gadget *gadget;
-       int n_configs;
+       int n_configs = 0;
        /* zero terminates */
        int functions[2][sizeof(gadget_id->function_mask)*8];
        int n_functions;
@@ -285,7 +285,7 @@ static int simple_id_to_gadget(struct usb_gadget_id *gadget_id,
                break;
        };
 
-       if (n_configs > 2) {
+       if (n_configs > 2 || n_configs <= 0) {
                ret = -EINVAL;
                goto free_gadget;
        }