[PATCH] fix build on Hurd which doesn't define PATH_MAX

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

 



Hurd doesn't define PATH_MAX but is needed by pre-process.c

Allow sparse to build on Hurd by giving it a default value
of 4096.

Note: this solution is not ideal because *if* the path is
      longer than PATH_MAX (and this *can* also happen on
      non-hurd machine) then we have a nice buffer flow
      which will corrupt the stack.
      A better solution will come later.

Reported-by: Uwe Kleine-König <uwe@xxxxxxxxxxxxxxxxx>
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx>
---
 pre-process.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/pre-process.c b/pre-process.c
index c6c6cdada..7d335ab0c 100644
--- a/pre-process.c
+++ b/pre-process.c
@@ -848,6 +848,10 @@ static void set_stream_include_path(struct stream *stream)
 	includepath[0] = path;
 }
 
+#ifndef PATH_MAX
+#define PATH_MAX 4096	// for Hurd where it's not defined
+#endif
+
 static int try_include(const char *path, const char *filename, int flen, struct token **where, const char **next_path)
 {
 	int fd;
-- 
2.17.0

--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux