mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-01-03 12:00:59 +00:00
Fix emulator strlcpy implementation (#298)
This commit is contained in:
parent
2391beb6f4
commit
3000a4ac8d
@ -23,19 +23,22 @@
|
||||
|
||||
size_t strlcpy(char *dst, const char *src, size_t size) {
|
||||
if (size == 0) {
|
||||
return 0;
|
||||
return strlen(src);
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < size - 1; i++) {
|
||||
size_t i;
|
||||
for (i = 0; i < size - 1; i++) {
|
||||
dst[i] = src[i];
|
||||
|
||||
if (src[i] == '\0') {
|
||||
return i;
|
||||
return i - 1;
|
||||
}
|
||||
}
|
||||
|
||||
dst[size - 1] = '\0';
|
||||
return size - 2;
|
||||
|
||||
while (src[i++] != '\0');
|
||||
return i - 1;
|
||||
}
|
||||
|
||||
size_t strlcat(char *dst, const char *src, size_t size) {
|
||||
|
Loading…
Reference in New Issue
Block a user