[PATCH 2/3] glx: Use PATH_MAX as size for filename buffer

Christopher James Halse Rogers christopher.halse.rogers at canonical.com
Sun Mar 6 19:11:46 PST 2011


Signed-off-by: Christopher James Halse Rogers <christopher.halse.rogers at canonical.com>
---
 glx/glxdricommon.c |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/glx/glxdricommon.c b/glx/glxdricommon.c
index 5569ab7..f9f7f5b 100644
--- a/glx/glxdricommon.c
+++ b/glx/glxdricommon.c
@@ -40,6 +40,17 @@
 #include "glxscreens.h"
 #include "glxdricommon.h"
 
+#ifndef PATH_MAX
+#include <sys/param.h>
+#ifndef PATH_MAX
+#ifdef MAXPATHLEN
+#define PATH_MAX MAXPATHLEN
+#else
+#define PATH_MAX 1024
+#endif
+#endif
+#endif 
+
 static int
 getUST(int64_t *ust)
 {
@@ -215,7 +226,7 @@ glxProbeDriver(const char *driverName,
 {
     int i;
     void *driver;
-    char filename[128];
+    char filename[PATH_MAX];
     const __DRIextension **extensions;
 
     snprintf(filename, sizeof filename, "%s/%s_dri.so",
-- 
1.7.4.1



More information about the xorg-devel mailing list