diff options
author | 2016-08-05 13:33:21 +0000 | |
---|---|---|
committer | 2016-08-05 13:33:21 +0000 | |
commit | ac2d47dbb48a029808eccbc0f36a4e97bb79c064 (patch) | |
tree | 7f363c1070de442de636cd94b4b642967896ad43 | |
parent | Unmask the timer output signal for real. (diff) | |
download | wireguard-openbsd-ac2d47dbb48a029808eccbc0f36a4e97bb79c064.tar.xz wireguard-openbsd-ac2d47dbb48a029808eccbc0f36a4e97bb79c064.zip |
If "%%" appears in the format string, skip it properly.
Part of pjanzen's fixes in r1.8, but was lost in r1.17.
Fixes regression tests wp3, wp4, wp5.
'good direction' deraadt
-rw-r--r-- | usr.bin/jot/jot.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/usr.bin/jot/jot.c b/usr.bin/jot/jot.c index 62771001714..19bd6600412 100644 --- a/usr.bin/jot/jot.c +++ b/usr.bin/jot/jot.c @@ -1,4 +1,4 @@ -/* $OpenBSD: jot.c,v 1.29 2016/08/05 13:21:31 tb Exp $ */ +/* $OpenBSD: jot.c,v 1.30 2016/08/05 13:33:21 tb Exp $ */ /* $NetBSD: jot.c,v 1.3 1994/12/02 20:29:43 pk Exp $ */ /*- @@ -394,8 +394,11 @@ getformat(void) if (boring) /* no need to bother */ return; for (p = format; *p != '\0'; p++) /* look for '%' */ - if (*p == '%' && *(p+1) != '%') /* leave %% alone */ - break; + if (*p == '%') { + if (*(p+1) != '%') + break; + p++; /* leave %% alone */ + } sz = sizeof(format) - strlen(format) - 1; if (*p == '\0' && !chardata) { int n; |