aboutsummaryrefslogtreecommitdiffstats
path: root/lib/is_single_threaded.c
diff options
context:
space:
mode:
authorDan Carpenter <error27@gmail.com>2010-05-14 09:24:37 -0400
committerJohn W. Linville <linville@tuxdriver.com>2010-06-02 16:13:07 -0400
commit2b87f3aac04818f720956e2b70f9b04fc8e2c794 (patch)
tree9fa916f24bab2b5d98259e76bd17afae76ed2abe /lib/is_single_threaded.c
parent56824223ac97ca845652c59bed9ce139e100261b (diff)
ath9k/debug: improve the snprintf() handling
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>
Diffstat (limited to 'lib/is_single_threaded.c')
0 files changed, 0 insertions, 0 deletions