diff options
author | Clint Adams <clint@users.sourceforge.net> | 2004-05-04 04:17:26 +0000 |
---|---|---|
committer | Clint Adams <clint@users.sourceforge.net> | 2004-05-04 04:17:26 +0000 |
commit | c98b9dc800171365eee34a3adbf5a741dbef69ca (patch) | |
tree | 7ca4f798e51ff57fd54468e2c951dcc6eef3b55e /Src/utils.c | |
parent | 885509c023dadf766f14c6a51d60048c835e1cd7 (diff) | |
download | zsh-c98b9dc800171365eee34a3adbf5a741dbef69ca.tar.gz zsh-c98b9dc800171365eee34a3adbf5a741dbef69ca.tar.xz zsh-c98b9dc800171365eee34a3adbf5a741dbef69ca.zip |
* 19869: Src/prompt.c, Src/utils.c: avoid segfault when
prompt-expanding '%D{%p}' or '%D{%P}' under locales with null strings for am_pm.
Diffstat (limited to 'Src/utils.c')
-rw-r--r-- | Src/utils.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/Src/utils.c b/Src/utils.c index 2e061e591..c0a96a5b4 100644 --- a/Src/utils.c +++ b/Src/utils.c @@ -1831,7 +1831,8 @@ ztrftime(char *buf, int bufsize, char *fmt, struct tm *tm) */ *buf = '\0'; tmp[1] = fmt[-1]; - if (!strftime(buf, bufsize + 2, tmp, tm)) + if (!strftime(buf, bufsize + 2, tmp, tm) && + tmp[1]!='p' && tmp[1]!='P') return 0; decr = strlen(buf); buf += decr; |