From: Juan Zea <juan.zea@qindel.com>
To: linux-usb@vger.kernel.org
Cc: Valentina Manea <valentina.manea.m@gmail.com>,
Shuah Khan <shuah@kernel.org>,
linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] usbip: fix usbip bind writing random string after command in match_busid
Date: Wed, 13 Dec 2017 12:07:40 +0100 (CET) [thread overview]
Message-ID: <473236275.1374013.1513163260837.JavaMail.zimbra@qindel.com> (raw)
In-Reply-To: <204103862.1370220.1513160163538.JavaMail.zimbra@qindel.com>
usbip bind writes commands followed by random string when writing to
match_busid attribute in sysfs, caused by using full variable size
instead of string length.
Signed-off-by: Juan Zea <juan.zea@qindel.com>
---
tools/usb/usbip/src/utils.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/usb/usbip/src/utils.c b/tools/usb/usbip/src/utils.c
index 2b3d6d2..ea1a1af 100644
--- a/tools/usb/usbip/src/utils.c
+++ b/tools/usb/usbip/src/utils.c
@@ -42,7 +42,7 @@ int modify_match_busid(char *busid, int add)
snprintf(command, SYSFS_BUS_ID_SIZE + 4, "del %s", busid);
rc = write_sysfs_attribute(match_busid_attr_path, command,
- sizeof(command));
+ strlen(command));
if (rc < 0) {
dbg("failed to write match_busid: %s", strerror(errno));
return -1;
--
2.7.4
next parent reply other threads:[~2017-12-13 11:13 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <204103862.1370220.1513160163538.JavaMail.zimbra@qindel.com>
2017-12-13 11:07 ` Juan Zea [this message]
2017-12-13 17:42 ` Shuah Khan
2017-12-14 10:23 ` Juan Zea
2017-12-14 20:14 ` Shuah Khan
2017-12-15 9:21 ` Juan Zea
2017-12-15 17:39 ` Shuah Khan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=473236275.1374013.1513163260837.JavaMail.zimbra@qindel.com \
--to=juan.zea@qindel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=shuah@kernel.org \
--cc=valentina.manea.m@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome