Use sprintf to avoid buffer overflows.
This commit is contained in:
parent
82e77742b5
commit
b4f6994278
1 changed files with 3 additions and 2 deletions
|
@ -233,7 +233,8 @@ void fprintlog(struct filed * fLog, int flags, char *message)
|
|||
} else
|
||||
message = fLog->f_prevline;
|
||||
}
|
||||
sprintf(line, "%s %s %s", fLog->f_lasttime, fLog->f_prevhost, message);
|
||||
snprintf(line, sizeof(line), "%s %s %s",
|
||||
fLog->f_lasttime, fLog->f_prevhost, message);
|
||||
DEBUG(dprintf("Logging to %s", TypeNames[fLog->f_type]);)
|
||||
fLog->f_time = now;
|
||||
switch (fLog->f_type) {
|
||||
|
@ -640,7 +641,7 @@ void printkline(char *hname, char *msg)
|
|||
int ch, pri = DEFUPRI;
|
||||
|
||||
/* Copies message to local buffer, adding source program tag */
|
||||
sprintf(line, "kernel: %s", msg);
|
||||
snprintf(line, sizeof(line), "kernel: %s", msg);
|
||||
|
||||
logmsg(LOG_KERN | LOG_INFO, line, hname, ADDDATE);
|
||||
return;
|
||||
|
|
Loading…
Reference in a new issue