Use sprintf to avoid buffer overflows.
This commit is contained in:
parent
82e77742b5
commit
b4f6994278
@ -233,7 +233,8 @@ void fprintlog(struct filed * fLog, int flags, char *message)
|
|||||||
} else
|
} else
|
||||||
message = fLog->f_prevline;
|
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]);)
|
DEBUG(dprintf("Logging to %s", TypeNames[fLog->f_type]);)
|
||||||
fLog->f_time = now;
|
fLog->f_time = now;
|
||||||
switch (fLog->f_type) {
|
switch (fLog->f_type) {
|
||||||
@ -640,7 +641,7 @@ void printkline(char *hname, char *msg)
|
|||||||
int ch, pri = DEFUPRI;
|
int ch, pri = DEFUPRI;
|
||||||
|
|
||||||
/* Copies message to local buffer, adding source program tag */
|
/* 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);
|
logmsg(LOG_KERN | LOG_INFO, line, hname, ADDDATE);
|
||||||
return;
|
return;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user