2b87f3aac0
The snprintf() function returns the number of bytes that *would* have been written (not counting the NULL terminator) and that can potentally be more than the size of the buffer. In this patch if there were one liners where string clearly fits into the buffer, then I changed snprintf to sprintf(). It's confusing to use the return value of snprintf() as a limitter without verifying that it's smaller than size. This is what initially caught my attention here. If we use the return value of sprintf() instead future code auditors will assume we've verified that it fits already. Also I did find some places where it made sense to use the return value after we've verified that it is smaller than the buffer size. Finally the read_file_rcstat() function added an explicit NULL terminator before calling snprintf(). That's unnecessary because snprintf() will add the null terminator automatically. Signed-off-by: Dan Carpenter <error27@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com> |
||
---|---|---|
.. | ||
ahb.c | ||
ani.c | ||
ani.h | ||
ar5008_initvals.h | ||
ar5008_phy.c | ||
ar9001_initvals.h | ||
ar9002_calib.c | ||
ar9002_hw.c | ||
ar9002_initvals.h | ||
ar9002_mac.c | ||
ar9002_phy.c | ||
ar9002_phy.h | ||
ar9003_2p0_initvals.h | ||
ar9003_2p2_initvals.h | ||
ar9003_calib.c | ||
ar9003_eeprom.c | ||
ar9003_eeprom.h | ||
ar9003_hw.c | ||
ar9003_mac.c | ||
ar9003_mac.h | ||
ar9003_phy.c | ||
ar9003_phy.h | ||
ath9k.h | ||
beacon.c | ||
btcoex.c | ||
btcoex.h | ||
calib.c | ||
calib.h | ||
common.c | ||
common.h | ||
debug.c | ||
debug.h | ||
eeprom_4k.c | ||
eeprom_9287.c | ||
eeprom_def.c | ||
eeprom.c | ||
eeprom.h | ||
gpio.c | ||
hif_usb.c | ||
hif_usb.h | ||
htc_drv_beacon.c | ||
htc_drv_init.c | ||
htc_drv_main.c | ||
htc_drv_txrx.c | ||
htc_hst.c | ||
htc_hst.h | ||
htc.h | ||
hw-ops.h | ||
hw.c | ||
hw.h | ||
init.c | ||
Kconfig | ||
mac.c | ||
mac.h | ||
main.c | ||
Makefile | ||
pci.c | ||
phy.h | ||
rc.c | ||
rc.h | ||
recv.c | ||
reg.h | ||
virtual.c | ||
wmi.c | ||
wmi.h | ||
xmit.c |