aboutsummaryrefslogtreecommitdiff
path: root/tools/usb/usbip/libsrc/usbip_host_common.c
AgeCommit message (Collapse)AuthorFilesLines
2018-10-18usbip: tools: fix atoi() on non-null terminated stringColin Ian King1-3/+3
Currently the call to atoi is being passed a single char string that is not null terminated, so there is a potential read overrun along the stack when parsing for an integer value. Fix this by instead using a 2 char string that is initialized to all zeros to ensure that a 1 char read into the string is always terminated with a \0. Detected by cppcheck: "Invalid atoi() argument nr 1. A nul-terminated string is required." Fixes: 3391ba0e2792 ("usbip: tools: Extract generic code to be shared with vudc backend") Signed-off-by: Colin Ian King <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2018-03-09usbip: usbip_host_common: Use new error codes to return request statusShuah Khan1-1/+4
Currently ST_OK and ST_NA are the only values used to communicate status of a request from a client. Use new error codes to clearly indicate what failed. For example, when client sends request to import a device that isn't export-able, send ST_DEV_BUSY to the client. Signed-off-by: Shuah Khan <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2017-03-17usbip: Fix potential format overflow in userspace toolsJonathan Dieter1-5/+23
The usbip userspace tools call sprintf()/snprintf() and don't check for the return value which can lead the paths to overflow, truncating the final file in the path. More urgently, GCC 7 now warns that these aren't checked with -Wformat-overflow, and with -Werror enabled in configure.ac, that makes these tools unbuildable. This patch fixes these problems by replacing sprintf() with snprintf() in one place and adding checks for the return value of snprintf(). Reviewed-by: Peter Senna Tschudin <[email protected]> Signed-off-by: Jonathan Dieter <[email protected]> Acked-by: Shuah Khan <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2016-04-26usbip: tools: Extract generic code to be shared with vudc backendKrzysztof Opasiak1-0/+273
Extract the code from current stub driver backend and a common interface for both stub driver and vudc. This allows to share most of the usbipd code for both of them. Based on code created in cooperation with Open Operating Systems Student Society at University of Warsaw (O2S3@UW) consisting of: Igor Kotrasinski <[email protected]> Karol Kosik <[email protected]> Ewelina Kosmider <[email protected]> Dawid Lazarczyk <[email protected]> Piotr Szulc <[email protected]> Tutor and project owner: Krzysztof Opasiak <[email protected]> Signed-off-by: Krzysztof Opasiak <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>