summaryrefslogtreecommitdiff
path: root/accel-pppd/logs
diff options
context:
space:
mode:
authorKozlov Dmitry <xeb@mail.ru>2012-05-28 18:34:36 +0400
committerKozlov Dmitry <xeb@mail.ru>2012-05-28 18:34:36 +0400
commit0a823d8d044f023a8fbe388e1b5235b660c5127b (patch)
tree900dd7fc6802fb3ea9f6ac9ba2aa036cc4341939 /accel-pppd/logs
parentd28a6eb2a5a672b235a5cb8055c0764565b1e526 (diff)
downloadaccel-ppp-0a823d8d044f023a8fbe388e1b5235b660c5127b.tar.gz
accel-ppp-0a823d8d044f023a8fbe388e1b5235b660c5127b.zip
log_syslog: check buffer overflow
Diffstat (limited to 'accel-pppd/logs')
-rw-r--r--accel-pppd/logs/log_syslog.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/accel-pppd/logs/log_syslog.c b/accel-pppd/logs/log_syslog.c
index 7dfa260d..5a922f57 100644
--- a/accel-pppd/logs/log_syslog.c
+++ b/accel-pppd/logs/log_syslog.c
@@ -52,9 +52,10 @@ static void unpack_msg(struct log_msg_t *msg)
static void set_hdr(struct log_msg_t *msg, struct ppp_t *ppp)
{
- if (ppp)
- sprintf(msg->hdr->msg, "%s:%s: ", ppp->ifname, ppp->username ? ppp->username : "");
- else
+ if (ppp) {
+ if (snprintf(msg->hdr->msg, LOG_CHUNK_SIZE, "%s:%s: ", ppp->ifname, ppp->username ? ppp->username : ""))
+ strcpy(msg->hdr->msg + LOG_CHUNK_SIZE - 3, ": ");
+ } else
msg->hdr->msg[0] = 0;
}