mirror of
https://github.com/espressif/esp-nimble.git
synced 2026-08-26 03:39:59 +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:
committed by
Abhinav Kudnar
parent
31b5f30397
commit
03df51a35c
@@ -473,8 +473,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;
|
||||
omi->omi_name[0] = '\0';
|
||||
strncat(omi->omi_name, cur->name, sizeof(omi->omi_name) - 1);
|
||||
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