commit 1e22e8e41463896755b37d45bf76e14683e30f94
parent 80b4aedc11325793331a7bffb46e32ae3f9af8ac
Author: rsc <devnull@localhost>
Date: Thu, 4 May 2006 18:54:09 +0000
sign extension bug
Diffstat:
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/src/libsunrpc/rpc.c b/src/libsunrpc/rpc.c
@@ -439,9 +439,10 @@ sunstringunpack(uchar *a, uchar *ea, uchar **pa, char **s, u32int max)
if(sunvaropaqueunpack(a, ea, pa, &dat, &n, max) < 0)
goto Err;
/* slide string down over length to make room for NUL */
- memmove(dat-1, dat, n);
- dat[n-1] = 0;
- *s = (char*)(dat-1);
+ dat--;
+ memmove(dat, dat+1, n);
+ dat[n] = 0;
+ *s = (char*)dat;
return 0;
Err:
return -1;