diff options
| author | Peter Stephenson <p.w.stephenson@ntlworld.com> | 2015-09-21 20:33:58 +0100 |
|---|---|---|
| committer | Peter Stephenson <p.w.stephenson@ntlworld.com> | 2015-09-21 20:33:58 +0100 |
| commit | 729f6ddfff8a229c404f0ec2b9d83c89395e541d (patch) | |
| tree | b369afbfa57557ae5549cee929e4f984590a0cae /Src/Zle/compmatch.c | |
| parent | 36577: supplement 36559 to using LONG_MAX for 64-bit long (diff) | |
| download | zsh-729f6ddfff8a229c404f0ec2b9d83c89395e541d.tar zsh-729f6ddfff8a229c404f0ec2b9d83c89395e541d.tar.gz zsh-729f6ddfff8a229c404f0ec2b9d83c89395e541d.tar.bz2 zsh-729f6ddfff8a229c404f0ec2b9d83c89395e541d.tar.lz zsh-729f6ddfff8a229c404f0ec2b9d83c89395e541d.tar.xz zsh-729f6ddfff8a229c404f0ec2b9d83c89395e541d.tar.zst zsh-729f6ddfff8a229c404f0ec2b9d83c89395e541d.zip | |
36580: don't copy empty buffer in compmatch.
Also check if length is non-zero when buffer is empty.
Diffstat (limited to 'Src/Zle/compmatch.c')
| -rw-r--r-- | Src/Zle/compmatch.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/Src/Zle/compmatch.c b/Src/Zle/compmatch.c index 05ae43ae6..b5728a5fe 100644 --- a/Src/Zle/compmatch.c +++ b/Src/Zle/compmatch.c @@ -338,8 +338,15 @@ add_match_str(Cmatcher m, char *l, char *w, int wl, int sfx) char *buf; buf = (char *) zalloc(blen); - memcpy(buf, matchbuf, matchbuflen); - zfree(matchbuf, matchbuflen); + if (matchbuf) { + memcpy(buf, matchbuf, matchbuflen); + zfree(matchbuf, matchbuflen); + } +#ifdef DEBUG + else { + DPUTS(matchbuflen, "matchbuflen with no matchbuf"); + } +#endif matchbuf = buf; matchbuflen = blen; } |
