OSSP CVS Repository

ossp - Check-in [1092]
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [Patchset]  [Tagging/Branching

Check-in Number: 1092
Date: 2001-Oct-06 16:35:57 (local)
2001-Oct-06 14:35:57 (UTC)
User:rse
Branch:
Comment: Use save l2_util_sprintf instead of unsafe sprintf and correctly set variable "n" (number of characters).
Tickets:
Inspections:
Files:
ossp-pkg/l2/l2_ch_syslog.c      1.22 -> 1.23     6 inserted, 6 deleted

ossp-pkg/l2/l2_ch_syslog.c 1.22 -> 1.23

--- l2_ch_syslog.c       2001/10/06 14:33:09     1.22
+++ l2_ch_syslog.c       2001/10/06 14:35:57     1.23
@@ -283,13 +283,13 @@
         if (caTime[4] == '0')
             caTime[4] = ' ';
         if (cfg->bLogPid) 
-            sprintf(caBuf, "<%d>%s %s %s[%lu]: %s", 
-                    prio, caTime, cfg->szLocalHost, 
-                    cfg->szIdent, (unsigned long)getpid(), buf);
+            n = l2_util_sprintf(caBuf, sizeof(caBuf), "<%d>%s %s %s[%lu]: %s", 
+                                prio, caTime, cfg->szLocalHost, 
+                                cfg->szIdent, (unsigned long)getpid(), buf);
         else
-            sprintf(caBuf, "<%d>%s %s %s: %s", 
-                    prio, caTime, cfg->szLocalHost, 
-                    cfg->szIdent, buf);
+            n = l2_util_sprintf(caBuf, sizeof(caBuf), "<%d>%s %s %s: %s", 
+                                prio, caTime, cfg->szLocalHost, 
+                                cfg->szIdent, buf);
         if ((n = strlen(caBuf)) > 1024)
             return L2_ERR_IO;
         if ((rc = sa_send(cfg->saRemoteSock, caBuf, n, 

CVSTrac 2.0.1