mirror of
https://github.com/espressif/esp-nimble.git
synced 2026-09-04 08:10:05 +00:00
nimble/porting: Explicitly NULL terminate potential non NULL terminated string buffer
os_mempool.c: Using strncpy, buffer will not be NULL terminated if size of source string is same as buffer size. Explicitly added NULL character at the end.
This commit is contained in:
@@ -346,7 +346,8 @@ os_mempool_info_get_next(struct os_mempool *mp, struct os_mempool_info *omi)
|
||||
omi->omi_num_blocks = cur->mp_num_blocks;
|
||||
omi->omi_num_free = cur->mp_num_free;
|
||||
omi->omi_min_free = cur->mp_min_free;
|
||||
strncpy(omi->omi_name, cur->name, sizeof(omi->omi_name));
|
||||
strncpy(omi->omi_name, cur->name, sizeof(omi->omi_name) - 1);
|
||||
omi->omi_name[sizeof(omi->omi_name) - 1] = '\0';
|
||||
|
||||
return (cur);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user