From dad3b78df228cf60065bbb59441276daf66f23ad Mon Sep 17 00:00:00 2001 From: Apoorv Raghuvanshi Date: Wed, 29 Jan 2014 15:31:32 -0800 Subject: [PATCH] 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 --- hal/audio_extn/usb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hal/audio_extn/usb.c b/hal/audio_extn/usb.c index 88e3cad0..699c3b7d 100644 --- a/hal/audio_extn/usb.c +++ b/hal/audio_extn/usb.c @@ -152,7 +152,7 @@ static int usb_get_capability(char *type, int32_t *channels, 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); str_start = strstr(read_buf, type); if (str_start == NULL) {