mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-01-01 05:16:05 +01:00
50736: silence use-after-free warning (gcc-12.2)
This commit is contained in:
parent
b7f280ab59
commit
727b493e2b
2 changed files with 9 additions and 4 deletions
|
@ -1,3 +1,8 @@
|
|||
2022-10-17 Jun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp>
|
||||
|
||||
* Wesley Schwengle: 50736: Src/Zle/compmatch.c: silence
|
||||
use-after-free waring (gcc-12.2)
|
||||
|
||||
2022-09-29 Jun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp>
|
||||
|
||||
* 50671: Util/ztst-syntax.vim: enable spell check in *.ztst
|
||||
|
|
|
@ -2045,12 +2045,12 @@ join_strs(int la, char *sa, int lb, char *sb)
|
|||
zlelineasstring(line, mp->llen, 0, &convlen,
|
||||
NULL, 0);
|
||||
if (rr <= convlen) {
|
||||
char *or = rs;
|
||||
ptrdiff_t diff = rp - rs;
|
||||
int alloclen = (convlen > 20) ? convlen : 20;
|
||||
|
||||
rs = realloc(rs, (rl += alloclen));
|
||||
rr += alloclen;
|
||||
rp += rs - or;
|
||||
rp = rs + diff;
|
||||
}
|
||||
memcpy(rp, convstr, convlen);
|
||||
rp += convlen;
|
||||
|
@ -2073,11 +2073,11 @@ join_strs(int la, char *sa, int lb, char *sb)
|
|||
} else {
|
||||
/* Same character, just take it. */
|
||||
if (rr <= 1 /* HERE charlen */) {
|
||||
char *or = rs;
|
||||
ptrdiff_t diff = rp - rs;
|
||||
|
||||
rs = realloc(rs, (rl += 20));
|
||||
rr += 20;
|
||||
rp += rs - or;
|
||||
rp = rs + diff;
|
||||
}
|
||||
/* HERE: multibyte char */
|
||||
*rp++ = *sa;
|
||||
|
|
Loading…
Reference in a new issue