FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Redhat > Cluster Development

 
 
LinkBack Thread Tools
 
Old 10-10-2011, 08:45 AM
"Fabio M. Di Nitto"
 
Default liblogthread: use snprintf as it is considered safer

avoid security warning

Spotted by Coverity Scan

Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
---
:100644 100644 384f042... 7230b2f... M common/liblogthread/liblogthread.c
common/liblogthread/liblogthread.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/common/liblogthread/liblogthread.c b/common/liblogthread/liblogthread.c
index 384f042..7230b2f 100644
--- a/common/liblogthread/liblogthread.c
+++ b/common/liblogthread/liblogthread.c
@@ -69,7 +69,7 @@ static void write_entry(int level, time_t *t, char *str)
static void write_dropped(int level, time_t *t, int num)
{
char str[ENTRY_STR_LEN];
- sprintf(str, "dropped %d entries", num);
+ snprintf(str, sizeof(str) - 1, "dropped %d entries", num);
write_entry(level, t, str);
}

--
1.7.4.4
 
Old 10-10-2011, 08:45 AM
"Fabio M. Di Nitto"
 
Default liblogthread: use snprintf as it is considered safer

avoid security warning

Spotted by Coverity Scan

Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
---
:100644 100644 384f042... 7230b2f... M common/liblogthread/liblogthread.c
common/liblogthread/liblogthread.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/common/liblogthread/liblogthread.c b/common/liblogthread/liblogthread.c
index 384f042..7230b2f 100644
--- a/common/liblogthread/liblogthread.c
+++ b/common/liblogthread/liblogthread.c
@@ -69,7 +69,7 @@ static void write_entry(int level, time_t *t, char *str)
static void write_dropped(int level, time_t *t, int num)
{
char str[ENTRY_STR_LEN];
- sprintf(str, "dropped %d entries", num);
+ snprintf(str, sizeof(str) - 1, "dropped %d entries", num);
write_entry(level, t, str);
}

--
1.7.4.4
 

Thread Tools




All times are GMT. The time now is 07:34 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org