0001-Fix-stack-buffer-overflow-at-zlog_conf_build_with_file.patch 843 B

12345678910111213141516171819202122232425
  1. From a5be8b3a8ddc498de4ad041757285136a55d97e3 Mon Sep 17 00:00:00 2001
  2. From: XiangfeiCH <chenthrone@163.com>
  3. Date: Tue, 12 Apr 2022 00:13:35 +0800
  4. Subject: [PATCH] Fix stack-buffer-overflow at zlog_conf_build_with_file
  5. [Retrieved from:
  6. https://github.com/HardySimpson/zlog/commit/a5be8b3a8ddc498de4ad041757285136a55d97e3]
  7. Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
  8. ---
  9. src/conf.c | 2 +-
  10. 1 file changed, 1 insertion(+), 1 deletion(-)
  11. diff --git a/src/conf.c b/src/conf.c
  12. index 0f862fa..9a4cb75 100644
  13. --- a/src/conf.c
  14. +++ b/src/conf.c
  15. @@ -305,7 +305,7 @@ static int zlog_conf_build_with_file(zlog_conf_t * a_conf)
  16. /* Oops the buffer is full - what now? */
  17. pline = line;
  18. } else {
  19. - for (p--; isspace((int)*p); --p)
  20. + for (p--; p >= line && isspace((int)*p); --p)
  21. /*EMPTY*/;
  22. p++;
  23. *p = 0;