diff options
author | brian <brian@cvs.openbsd.org> | 2001-08-18 19:41:10 +0000 |
---|---|---|
committer | brian <brian@cvs.openbsd.org> | 2001-08-18 19:41:10 +0000 |
commit | 15d6ad284f0af5998901f415984185ee5734c247 (patch) | |
tree | 26eb270e79501e516c35b2de4b43673278d174d8 /usr.sbin/ppp | |
parent | 3cb7084ef30e92b3858c31b6fb7fff891e8ea3bf (diff) |
A better fix
Diffstat (limited to 'usr.sbin/ppp')
-rw-r--r-- | usr.sbin/ppp/ppp/command.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/usr.sbin/ppp/ppp/command.c b/usr.sbin/ppp/ppp/command.c index 3c0880b76a8..81591c044a8 100644 --- a/usr.sbin/ppp/ppp/command.c +++ b/usr.sbin/ppp/ppp/command.c @@ -25,7 +25,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $OpenBSD: command.c,v 1.66 2001/08/18 19:34:33 brian Exp $ + * $OpenBSD: command.c,v 1.67 2001/08/18 19:41:09 brian Exp $ */ #include <sys/param.h> @@ -250,14 +250,17 @@ HelpCommand(struct cmdargs const *arg) static int IdentCommand(struct cmdargs const *arg) { - int f, max, pos; + int f, max, n, pos; *arg->cx->physical->link.lcp.cfg.ident = '\0'; max = sizeof arg->cx->physical->link.lcp.cfg.ident; - for (pos = 0, f = arg->argn; f < arg->argc && pos < max; f++) - pos += snprintf(arg->cx->physical->link.lcp.cfg.ident + pos, max - pos, - "%s%s", f == arg->argn ? "" : " ", arg->argv[f]); + for (pos = 0, f = arg->argn; f < arg->argc && pos < max; f++) { + n = snprintf(arg->cx->physical->link.lcp.cfg.ident + pos, max - pos, + "%s%s", f == arg->argn ? "" : " ", arg->argv[f]); + if (n == -1 || (pos += n) >= max) + break; + } return 0; } |