summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorbrian <brian@cvs.openbsd.org>2001-08-21 04:09:19 +0000
committerbrian <brian@cvs.openbsd.org>2001-08-21 04:09:19 +0000
commitb5155ca0f3a2c0338923fe8ddf0f4aaee8deacb5 (patch)
treeecae0a6524f987f6dcfed4cf118d8df177fd4084 /usr.sbin
parent3d268f5ce0636f6861d6cae07dcd3603ac54b4dc (diff)
Handle snprintf() returning < -1
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/ppp/ppp/command.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/usr.sbin/ppp/ppp/command.c b/usr.sbin/ppp/ppp/command.c
index f74e8da5609..d4d008ddc8c 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.68 2001/08/19 23:22:17 brian Exp $
+ * $OpenBSD: command.c,v 1.69 2001/08/21 04:09:18 brian Exp $
*/
#include <sys/param.h>
@@ -263,7 +263,11 @@ IdentCommand(struct cmdargs const *arg)
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)
+ if (n < 0) {
+ arg->cx->physical->link.lcp.cfg.ident[pos] = '\0';
+ break;
+ }
+ if ((pos += n) >= max)
break;
}