summaryrefslogtreecommitdiff
path: root/sys/src/libsunrpc
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@felloff.net>2021-03-29 17:13:50 +0200
committercinap_lenrek <cinap_lenrek@felloff.net>2021-03-29 17:13:50 +0200
commit4a83ce37c649dbcfb5a87c022aad626226904363 (patch)
tree5dc21903c3218cb0755ff837127313c53157fa89 /sys/src/libsunrpc
parent9e1d26893f8a92c32f3486883c46e8cdfff03e98 (diff)
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.
Diffstat (limited to 'sys/src/libsunrpc')
-rw-r--r--sys/src/libsunrpc/rpc.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sys/src/libsunrpc/rpc.c b/sys/src/libsunrpc/rpc.c
index 657e04233..ee075c57c 100644
--- a/sys/src/libsunrpc/rpc.c
+++ b/sys/src/libsunrpc/rpc.c
@@ -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;