aboutsummaryrefslogtreecommitdiffstats
path: root/menu.c
diff options
context:
space:
mode:
authorokan2016-04-28 16:28:38 +0000
committerokan2016-04-28 16:28:38 +0000
commitb28fd6720f782f955c8dc63381d64c6010670791 (patch)
treef69337f4127db48bdd964df8a115ffcf38235596 /menu.c
parent30976a49c8637ba05c837e8d82c746ed7714e506 (diff)
downloadcwm-b28fd6720f782f955c8dc63381d64c6010670791.tar.gz
If supplied format to menuq_add() is NULL, fill text with an empty
string; found by Christian Neukirchen.
Diffstat (limited to 'menu.c')
-rw-r--r--menu.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/menu.c b/menu.c
index 6fd30b3..4a63a3c 100644
--- a/menu.c
+++ b/menu.c
@@ -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);