projects
/
platform
/
core
/
system
/
deviced.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
22ee164
)
usb: fix stack-buffer-underflow issue
58/131558/2
author
Yunmi Ha
<yunmi.ha@samsung.com>
Tue, 30 May 2017 04:40:03 +0000
(13:40 +0900)
committer
Yunmi Ha
<yunmi.ha@samsung.com>
Tue, 30 May 2017 08:27:19 +0000
(17:27 +0900)
Change-Id: I77b72b01a5182680f10d7a0a4a49e0e400ff63f5
Signed-off-by: Yunmi Ha <yunmi.ha@samsung.com>
src/usb/usb-state.c
patch
|
blob
|
history
diff --git
a/src/usb/usb-state.c
b/src/usb/usb-state.c
index
300df18
..
043340c
100755
(executable)
--- a/
src/usb/usb-state.c
+++ b/
src/usb/usb-state.c
@@
-115,6
+115,7
@@
char *usb_state_get_mode_str(unsigned int mode, char *str, size_t len)
{
int i;
int ret;
+ int flag = 0;
if (mode == USB_FUNCTION_NONE) {
snprintf(str, len, "%s", "");
@@
-127,12
+128,15
@@
char *usb_state_get_mode_str(unsigned int mode, char *str, size_t len)
return str;
str += ret;
len -= ret;
+ flag = 1;
}
}
+ if (flag == 1) {
+ /* eliminate trailing comma */
+ *(str - 1) = '\0';
+ }
}
- /* eliminate trailing comma */
- *(str - 1) = '\0';
return str;
}