Commit: 76f3c751ed11e05271a459c349603142821a992d
Parent: 2b35d9555024ef4b92d51358c20bb972bb29bb12
Author: Anderson Lizardo <anderson.lizardo@openbossa.org>
Committer: Johan Hedberg <johan.hedberg@intel.com>
Date: 2014-01-06 21:20:23
Tree: eb27d15f1020a300efb8376e7102b2e9003f3560

tools: Fix strncat() usage in hciconfig/hcitool According to strncat() manpage: "If src contains n or more characters, strncat() writes n+1 characters to dest (n from src plus the terminating null byte). Therefore, the size of dest must be at least strlen(dest)+n+1" While the current usage of strncat() cannot cause an overflow, if a bigger string is added to the switch()'s without increasing the static buffer, it would overflow by one byte due to the incorrect size calculation. Fixes clang errors like: tools/hciconfig.c:827:33: error: the value of the size argument in 'strncat' is too large, might lead to a buffer overflow [-Werror,-Wstrncat-size]

Diffstat

M tools/hciconfig.c | 21 ++++++++++++++- - - - - - -
M tools/hcitool.c | 23 +++++++++++++++- - - - - - - -

2 files changed, 29 insertions(+), 15 deletions(-)

View Full Diff | Patch