diff options
author | okan | 2016-04-28 16:28:38 +0000 |
---|---|---|
committer | okan | 2016-04-28 16:28:38 +0000 |
commit | b28fd6720f782f955c8dc63381d64c6010670791 (patch) | |
tree | f69337f4127db48bdd964df8a115ffcf38235596 | |
parent | 30976a49c8637ba05c837e8d82c746ed7714e506 (diff) | |
download | cwm-b28fd6720f782f955c8dc63381d64c6010670791.tar.gz |
If supplied format to menuq_add() is NULL, fill text with an empty
string; found by Christian Neukirchen.
Diffstat (limited to '')
-rw-r--r-- | menu.c | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -16,7 +16,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $OpenBSD: menu.c,v 1.89 2015/11/11 14:22:01 okan Exp $ + * $OpenBSD: menu.c,v 1.90 2016/04/28 16:28:38 okan Exp $ */ #include <sys/types.h> @@ -601,7 +601,10 @@ menuq_add(struct menu_q *mq, void *ctx, const char *fmt, ...) mi->ctx = ctx; va_start(ap, fmt); - (void)vsnprintf(mi->text, sizeof(mi->text), fmt, ap); + if (fmt != NULL) + (void)vsnprintf(mi->text, sizeof(mi->text), fmt, ap); + else + mi->text[0] = '\0'; va_end(ap); TAILQ_INSERT_TAIL(mq, mi, entry); |