code: plan9front

Download patch

ref: 4a83ce37c649dbcfb5a87c022aad626226904363
parent: 9e1d26893f8a92c32f3486883c46e8cdfff03e98
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Mon Mar 29 13:13:50 EDT 2021

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.

--- a/sys/src/libsunrpc/rpc.c
+++ b/sys/src/libsunrpc/rpc.c
@@ -428,8 +428,9 @@
 		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;