diff options
| author | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2018-04-29 09:13:36 +0200 |
|---|---|---|
| committer | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2018-05-04 18:44:30 +0200 |
| commit | 02a5a7597ea1148db91a25273d5add4dd43ec73e (patch) | |
| tree | 4f569bdd10a6371e5ed4ef81a729488aa8ae90bc | |
| parent | 551b85c8a241bd45b267db152eca4cb01eddce39 (diff) | |
| download | sparse-dev-02a5a7597ea1148db91a25273d5add4dd43ec73e.tar.gz | |
fix build on Hurd which doesn't define PATH_MAX
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@kleine-koenig.org>
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
| -rw-r--r-- | pre-process.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/pre-process.c b/pre-process.c index c6c6cdad..7d335ab0 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; |
