libsunrpc: work around arm64 compiler bug in sunStringUnpack()

The sunStringUnpack() routine was miscompiled by 7c, as
pointer arithmetic is done in 64 bit but the constant -1
offset got expended to a unsigned 32 bit integer.
This commit is contained in:
cinap_lenrek 2021-03-29 17:13:50 +02:00
parent 9e1d26893f
commit 4a83ce37c6

View file

@ -428,8 +428,9 @@ sunStringUnpack(uchar *a, uchar *ea, uchar **pa, char **s, u32int max)
goto Err;
/* slide string down over length to make room for NUL */
memmove(dat-1, dat, n);
dat[-1+n] = 0;
*s = (char*)(dat-1);
dat--;
dat[n] = 0;
*s = (char*)dat;
return 0;
Err:
return -1;