From ad44340734fa3bb97c4472c6b004fa4ebdab335b Mon Sep 17 00:00:00 2001 From: Stefan Agner Date: Thu, 7 Dec 2017 19:36:15 +0100 Subject: [PATCH] libusbgx: Do not write null terminator when using usbg_write_string() The helper usbg_write_string() adds one to the length of the provided string. This leads to usbg_write_buf() writting also a null terminator to the kernel which is not necessary/wrong. Provide usbg_write_buf the real string length. Signed-off-by: Stefan Agner [Add missing () to function names in commit msg] Signed-off-by: Krzysztof Opasiak --- src/usbg_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/usbg_common.c b/src/usbg_common.c index bd03498..b405a3d 100644 --- a/src/usbg_common.c +++ b/src/usbg_common.c @@ -204,7 +204,7 @@ int usbg_write_string(const char *path, const char *name, { int ret; - ret = usbg_write_buf(path, name, file, buf, strlen(buf) + 1); + ret = usbg_write_buf(path, name, file, buf, strlen(buf)); if (ret > 0) ret = 0;