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 11-23-2011, 09:15 AM
"Fabio M. Di Nitto"
 
Default notifyd: fix virtually impossible buffer overflows

Spotted by Coverity Scan

Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
---
:100644 100644 7b625c9... 3091d2f... M cman/notifyd/main.c
cman/notifyd/main.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/cman/notifyd/main.c b/cman/notifyd/main.c
index 7b625c9..3091d2f 100644
--- a/cman/notifyd/main.c
+++ b/cman/notifyd/main.c
@@ -136,7 +136,7 @@ static void lockfile(void)
exit(EXIT_FAILURE);
}

- sprintf(buf, "%d
", getpid());
+ snprintf(buf, sizeof(buf) - 1, "%d
", getpid());

error = write(fd, buf, strlen(buf));
if (error <= 0) {
@@ -182,7 +182,7 @@ static void init_logging(int reconf)
int logfile_priority = SYSLOGLEVEL;

memset(logfile, 0, PATH_MAX);
- sprintf(logfile, LOGDIR "/cmannotifyd.log");
+ snprintf(logfile, sizeof(logfile) - 1, LOGDIR "/cmannotifyd.log");

ccs_handle = ccs_connect();
if (ccs_handle > 0) {
--
1.7.4.4
 

Thread Tools




All times are GMT. The time now is 06:16 AM.

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