[llvm-commits] [vmkit] r51066 - /vmkit/trunk/lib/JnJVM/VMCore/Jnjvm.cpp
Nicolas Geoffray
nicolas.geoffray at lip6.fr
Tue May 13 13:18:21 PDT 2008
Author: geoffray
Date: Tue May 13 15:18:21 2008
New Revision: 51066
URL: http://llvm.org/viewvc/llvm-project?rev=51066&view=rev
Log:
Use PATH_MAX for the realpath buffer, as written in "man realpath".
Modified:
vmkit/trunk/lib/JnJVM/VMCore/Jnjvm.cpp
Modified: vmkit/trunk/lib/JnJVM/VMCore/Jnjvm.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/Jnjvm.cpp?rev=51066&r1=51065&r2=51066&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/Jnjvm.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/Jnjvm.cpp Tue May 13 15:18:21 2008
@@ -133,10 +133,10 @@
if (top != 0) {
memcpy(buf, cur, top);
buf[top] = 0;
- char* rp = (char*)malloc(4096);
- memset(rp, 0, 4096);
+ char* rp = (char*)malloc(PATH_MAX);
+ memset(rp, 0, PATH_MAX);
rp = realpath(buf, rp);
- if (rp[4095] == 0 && strlen(rp) != 0) {
+ if (rp[PATH_MAX - 1] == 0 && strlen(rp) != 0) {
struct stat st;
stat(rp, &st);
if ((st.st_mode & S_IFMT) == S_IFDIR) {
More information about the llvm-commits
mailing list