=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/format.c,v retrieving revision 1.106 retrieving revision 1.107 diff -c -r1.106 -r1.107 *** src/usr.bin/tmux/format.c 2016/04/29 14:05:24 1.106 --- src/usr.bin/tmux/format.c 2016/05/23 20:39:26 1.107 *************** *** 1,4 **** ! /* $OpenBSD: format.c,v 1.106 2016/04/29 14:05:24 nicm Exp $ */ /* * Copyright (c) 2011 Nicholas Marriott --- 1,4 ---- ! /* $OpenBSD: format.c,v 1.107 2016/05/23 20:39:26 nicm Exp $ */ /* * Copyright (c) 2011 Nicholas Marriott *************** *** 850,876 **** char * format_expand_time(struct format_tree *ft, const char *fmt, time_t t) { - char *tmp, *expanded; - size_t tmplen; struct tm *tm; if (fmt == NULL || *fmt == '\0') return (xstrdup("")); tm = localtime(&t); ! tmp = NULL; ! tmplen = strlen(fmt); ! do { ! tmp = xreallocarray(tmp, 2, tmplen); ! tmplen *= 2; ! } while (strftime(tmp, tmplen, fmt, tm) == 0); ! ! expanded = format_expand(ft, tmp); ! free(tmp); ! ! return (expanded); } /* Expand keys in a template. */ --- 850,867 ---- char * format_expand_time(struct format_tree *ft, const char *fmt, time_t t) { struct tm *tm; + char s[2048]; if (fmt == NULL || *fmt == '\0') return (xstrdup("")); tm = localtime(&t); ! if (strftime(s, sizeof s, fmt, tm) == 0) ! return (xstrdup("")); ! return (format_expand(ft, s)); } /* Expand keys in a template. */