[core] Replace strnlen in buf_append_str for Zephyr compatibility (#15892)
This commit is contained in:
1 parent
947c714f89
commit
1504ac3d19
1 file changed
+4
-1
@@ -1117,7 +1117,10 @@ inline size_t buf_append_str(char *buf, size_t size, size_t pos, const char *str
|
||||
return size;
|
||||
}
|
||||
size_t remaining = size - pos - 1; // reserve space for null terminator
|
||||
size_t len = strnlen(str, remaining);
|
||||
size_t len = 0;
|
||||
while (len < remaining && str[len] != '\0') {
|
||||
len++;
|
||||
}
|
||||
memcpy(buf + pos, str, len);
|
||||
pos += len;
|
||||
buf[pos] = '\0';
|
||||
|
||||
Reference in new issue
Block a user