diff options
author | Guillaume Nault <g.nault@alphalink.fr> | 2013-04-26 10:22:18 +0200 |
---|---|---|
committer | Dmitry Kozlov <xeb@mail.ru> | 2013-05-01 10:57:49 +0400 |
commit | e08cd5d552a80a2d3166ee1be9d49179322a553c (patch) | |
tree | 2990423a70e9fc90d79a2e25a793256d5c09dfd9 /accel-pppd/ctrl | |
parent | c91a2babe00212d73b4d972bd337ae5b9273d5ed (diff) | |
download | accel-ppp-e08cd5d552a80a2d3166ee1be9d49179322a553c.tar.gz accel-ppp-e08cd5d552a80a2d3166ee1be9d49179322a553c.zip |
l2tp: Fix PPP channel name
Allocate space for the terminationg null byte, to avoid truncating
PPP channel name.
Signed-off-by: Guillaume Nault <g.nault@alphalink.fr>
Diffstat (limited to 'accel-pppd/ctrl')
-rw-r--r-- | accel-pppd/ctrl/l2tp/l2tp.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/accel-pppd/ctrl/l2tp/l2tp.c b/accel-pppd/ctrl/l2tp/l2tp.c index 79d003e..ffcbb8a 100644 --- a/accel-pppd/ctrl/l2tp/l2tp.c +++ b/accel-pppd/ctrl/l2tp/l2tp.c @@ -1221,16 +1221,16 @@ static int l2tp_session_connect(struct l2tp_sess_t *sess) " snprintf() failed: %s\n", strerror(errno)); goto out_err; } - sess->ppp.ses.chan_name = _malloc(chan_sz); + sess->ppp.ses.chan_name = _malloc(chan_sz + 1); if (sess->ppp.ses.chan_name == NULL) { log_session(log_error, sess, "impossible to connect session:" " memory allocation failed\n"); goto out_err; } - if (snprintf(sess->ppp.ses.chan_name, chan_sz, "%s:%i session %i", + if (snprintf(sess->ppp.ses.chan_name, chan_sz + 1, "%s:%i session %i", addr, peer_port, sess->peer_sid) < 0) { log_session(log_error, sess, "impossible to connect session:" - " snprintf(%i) failed\n", chan_sz); + " snprintf(%i) failed\n", chan_sz + 1); goto out_err; } |