Update of /cvsroot/libsysio/libsysio/src
In directory sc8-pr-cvs1:/tmp/cvs-serv1751
Modified Files:
Tag: b_lustre
chdir.c
Log Message:
getcwd might return trash buffers since the pnode name length could be 0,
fixed by moving buf pointer 1 bytes backwards at any cases.
Index: chdir.c
===================================================================
RCS file: /cvsroot/libsysio/libsysio/src/chdir.c,v
retrieving revision 1.3
retrieving revision 1.3.8.1
diff -u -w -b -B -p -r1.3 -r1.3.8.1
--- chdir.c 9 Mar 2003 16:57:47 -0000 1.3
+++ chdir.c 17 Jun 2003 05:46:57 -0000 1.3.8.1
@@ -226,11 +226,10 @@ _sysio_p_path(struct pnode *pno, char **
* Add component and separator.
*/
cp -= pno->p_base->pb_name.len;
- if (pno->p_base->pb_name.len)
- (void )memcpy(cp--,
- pno->p_base->pb_name.name,
+ (void )memcpy(cp, pno->p_base->pb_name.name,
pno->p_base->pb_name.len);
- *cp = PATH_SEPARATOR;
+
+ *--cp = PATH_SEPARATOR;
pno = pno->p_parent;
} while (pno != pno->p_parent);
|