hal: Minor usb stability fix
- Adding buffer of one byte for the strstr usecase to make the passed string is NULL terminated. Change-Id: Ief8531e149b05f4020cb1338110bbfad4a74f7d0 Crs-fixed: 607454
This commit is contained in:
parent
2d477702a8
commit
dad3b78df2
|
@ -152,7 +152,7 @@ static int usb_get_capability(char *type, int32_t *channels,
|
||||||
|
|
||||||
file_size = st.st_size;
|
file_size = st.st_size;
|
||||||
|
|
||||||
read_buf = (char *)calloc(1, USB_BUFF_SIZE);
|
read_buf = (char *)calloc(1, USB_BUFF_SIZE + 1);
|
||||||
err = read(fd, read_buf, USB_BUFF_SIZE);
|
err = read(fd, read_buf, USB_BUFF_SIZE);
|
||||||
str_start = strstr(read_buf, type);
|
str_start = strstr(read_buf, type);
|
||||||
if (str_start == NULL) {
|
if (str_start == NULL) {
|
||||||
|
|
Loading…
Reference in New Issue