15-use-PATH_MAX-for-path-buffer.patch 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. From 1408b15b98635a13bad2e2a50b3c2ae2ccdf625b Mon Sep 17 00:00:00 2001
  2. From: Will Newton <will.newton@gmail.com>
  3. Date: Wed, 22 Sep 2010 15:59:13 +0100
  4. Subject: [PATCH] kconfig: Use PATH_MAX instead of 128 for path buffer sizes.
  5. This prevents the buffers being overflowed when using a config
  6. file with a long name. PATH_MAX is used elsewhere in the same
  7. file, so use it here as well.
  8. Signed-off-by: Will Newton <will.newton@imgtec.com>
  9. Acked-by: WANG Cong <xiyou.wangcong@gmail.com>
  10. Signed-off-by: Michal Marek <mmarek@suse.cz>
  11. ---
  12. confdata.c | 4 ++--
  13. 1 file changed, 2 insertions(+), 2 deletions(-)
  14. Index: config/confdata.c
  15. ===================================================================
  16. --- config.orig/confdata.c
  17. +++ config/confdata.c
  18. @@ -536,7 +536,7 @@
  19. struct menu *menu;
  20. const char *basename;
  21. const char *str;
  22. - char dirname[128], tmpname[128], newname[128];
  23. + char dirname[PATH_MAX+1], tmpname[PATH_MAX+1], newname[PATH_MAX+1];
  24. enum symbol_type type;
  25. time_t now;
  26. int use_timestamp = 1;
  27. @@ -660,7 +660,7 @@
  28. static int conf_split_config(void)
  29. {
  30. const char *name;
  31. - char path[128];
  32. + char path[PATH_MAX+1];
  33. char *opwd, *dir, *_name;
  34. char *s, *d, c;
  35. struct symbol *sym;