mirror of
https://github.com/intrepidcs/libicsneo.git
synced 2026-08-05 09:28:40 +02:00
Got rid of a strcpy
This commit is contained in:
@@ -56,7 +56,8 @@ bool icsneoSerialNumToString(uint32_t num, char* str, size_t* count) {
|
|||||||
*count = result.length() + 1; // This is how big of a buffer we need
|
*count = result.length() + 1; // This is how big of a buffer we need
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
strcpy(str, result.c_str()); // TODO bad
|
strncpy(str, result.c_str(), *count);
|
||||||
|
str[*count - 1] = '\0';
|
||||||
*count = result.length();
|
*count = result.length();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user