summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornicm <nicm@openbsd.org>2015-05-20 06:39:02 +0000
committernicm <nicm@openbsd.org>2015-05-20 06:39:02 +0000
commitbb8235cbe9e8876efd5df1148c4072ded5b4b38e (patch)
tree969f0e36c7f63aa0adecc0d0630815d05bab0cc5
parentNo need to check the return value of memcpy() if you actually checked this (diff)
downloadwireguard-openbsd-bb8235cbe9e8876efd5df1148c4072ded5b4b38e.tar.xz
wireguard-openbsd-bb8235cbe9e8876efd5df1148c4072ded5b4b38e.zip
Return empty string if format is empty rather than attempting to
allocate zero bytes.
-rw-r--r--usr.bin/tmux/format.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/usr.bin/tmux/format.c b/usr.bin/tmux/format.c
index 8b47b361f92..9bf9a1cd927 100644
--- a/usr.bin/tmux/format.c
+++ b/usr.bin/tmux/format.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: format.c,v 1.66 2015/05/12 15:29:29 nicm Exp $ */
+/* $OpenBSD: format.c,v 1.67 2015/05/20 06:39:02 nicm Exp $ */
/*
* Copyright (c) 2011 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -335,7 +335,7 @@ format_expand_time(struct format_tree *ft, const char *fmt, time_t t)
size_t tmplen;
struct tm *tm;
- if (fmt == NULL)
+ if (fmt == NULL || *fmt == '\0')
return (xstrdup(""));
tm = localtime(&t);