Re: [PATCH] Portability of dash to legacy systems, such as AT&T Unix PC : 03-name-max

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

The third part of the patch set supplies a definition of NAME_MAX
where one is lacking.

This is the case not only on UnixPC, but also on the Solaris platforms.

When supplying NAME_MAX, we may err towards values which are too
large, because NAME_MAX is used to ensure that a buffer used to hold
filenames while globbing is large enough. Hence I use PATH_MAX.

After having applied the 3 patches so far, the program should compile
on Solaris 11.

Regards,

Alain
diff -X ../exclude.txt -urN dash-0.5.12+02-stat64/src/system.h dash-0.5.12+03-name-max/src/system.h
--- dash-0.5.12+02-stat64/src/system.h	2020-06-03 02:23:24.000000000 +0000
+++ dash-0.5.12+03-name-max/src/system.h	2024-11-10 14:52:28.805681954 +0000
@@ -116,3 +116,11 @@
  * code
  */
 #define uninitialized_var(x) x = x
+
+#ifndef NAME_MAX
+/* NAME_MAX is only used in expand.c to make sure that we have a
+   buffer big enough to append the next local file part into during
+   globbing. So, in case of doubt, we need NAME_MAX to be bigger
+   rather than smaller, in order to prevent buffer overflow */
+# define NAME_MAX PATH_MAX
+#endif

[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux