1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-10-03 08:11:03 +02:00

36580: don't copy empty buffer in compmatch.

Also check if length is non-zero when buffer is empty.
This commit is contained in:
Peter Stephenson 2015-09-21 20:33:58 +01:00
parent 8b84419f45
commit 729f6ddfff
2 changed files with 14 additions and 2 deletions

View file

@ -1,3 +1,8 @@
2015-09-21 Peter Stephenson <p.w.stephenson@ntlworld.com>
* 36580: Src/Zle/compmatch.c: don't copy empty buffer and check
size is consistent.
2015-09-21 Frank Terbeck <ft@bewatermyfriend.org>
* 36575: Completion/Unix/Command/_tmux: _tmux: lock-server

View file

@ -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;
}