examples: xusb: replaced insecure sprintf with snprintf

Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
This commit is contained in:
Sean McBride
2017-12-27 22:34:22 -05:00
committed by Chris Dickens
parent 830a9cb27d
commit f66c63e9f0
2 changed files with 3 additions and 2 deletions

View File

@@ -183,7 +183,8 @@ static char* uuid_to_string(const uint8_t* uuid)
{
static char uuid_string[40];
if (uuid == NULL) return NULL;
sprintf(uuid_string, "{%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x}",
snprintf(uuid_string, sizeof(uuid_string),
"{%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x}",
uuid[0], uuid[1], uuid[2], uuid[3], uuid[4], uuid[5], uuid[6], uuid[7],
uuid[8], uuid[9], uuid[10], uuid[11], uuid[12], uuid[13], uuid[14], uuid[15]);
return uuid_string;

View File

@@ -1 +1 @@
#define LIBUSB_NANO 11235
#define LIBUSB_NANO 11236