You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Can we replace the use of strcpy(2) from String::concat(const char*, uint32_t) by strlcpy(2) or even memcpy ?
Without referencing strcpy(2) on your documentation, if we cast a struct into char*, we could had
a null terminator between the start and the end, and strcpy(2) will never copy at the last char.
unsigned char String::concat(const char *cstr, unsigned int length)
{
unsigned int newlen = len + length;
if (!cstr) return 0;
if (length == 0) return 1;
if (!reserve(newlen)) return 0;
strcpy(buffer + len, cstr);
len = newlen;
return 1;
}
Is it by choice, by using strcpy ?
Edit: The length is not taked care by strcpy, many edge case could resolve into BO