* path.cc (readlink): 'max' should be a 'min' or we'll suffer buffer overflow.

This commit is contained in:
Christopher Faylor 2000-09-05 21:51:06 +00:00
parent a36cd013b9
commit e321565bbc
2 changed files with 6 additions and 1 deletions

View File

@ -1,3 +1,8 @@
Tue Sep 5 17:49:34 2000 Christopher Faylor <cgf@cygnus.com>
* path.cc (readlink): 'max' should be a 'min' or we'll suffer
buffer overflow.
Mon Sep 4 22:53:58 2000 Christopher Faylor <cgf@cygnus.com>
* path.cc (cwd_win32): Eliminate.

View File

@ -2353,7 +2353,7 @@ readlink (const char *path, char *buf, int buflen)
return -1;
}
int len = max (buflen, (int) strlen (pathbuf.get_win32 ()));
int len = min (buflen, (int) strlen (pathbuf.get_win32 ()));
memcpy (buf, pathbuf.get_win32 (), len);
/* errno set by symlink.check if error */