You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
1.3 KiB

  1. From faf3315f77c527e6e1d027deb7e853cdf6af5858 Mon Sep 17 00:00:00 2001
  2. From: William Lallemand <wlallemand@haproxy.com>
  3. Date: Thu, 28 May 2015 18:03:51 +0200
  4. Subject: [PATCH 14/14] BUG/MEDIUM: cfgparse: segfault when userlist is misused
  5. If the 'userlist' keyword parsing returns an error and no userlist were
  6. previously created. The parsing of 'user' and 'group' leads to NULL
  7. derefence.
  8. The userlist pointer is now tested to prevent this issue.
  9. (cherry picked from commit 4ac9f546120d42be8147e3d90588e7b9738af0cc)
  10. ---
  11. src/cfgparse.c | 5 +++++
  12. 1 file changed, 5 insertions(+)
  13. diff --git a/src/cfgparse.c b/src/cfgparse.c
  14. index 3c3383d..392a78d 100644
  15. --- a/src/cfgparse.c
  16. +++ b/src/cfgparse.c
  17. @@ -5668,6 +5668,9 @@ cfg_parse_users(const char *file, int linenum, char **args, int kwm)
  18. goto out;
  19. }
  20. + if (!userlist)
  21. + goto out;
  22. +
  23. for (ag = userlist->groups; ag; ag = ag->next)
  24. if (!strcmp(ag->name, args[1])) {
  25. Warning("parsing [%s:%d]: ignoring duplicated group '%s' in userlist '%s'.\n",
  26. @@ -5718,6 +5721,8 @@ cfg_parse_users(const char *file, int linenum, char **args, int kwm)
  27. err_code |= ERR_ALERT | ERR_FATAL;
  28. goto out;
  29. }
  30. + if (!userlist)
  31. + goto out;
  32. for (newuser = userlist->users; newuser; newuser = newuser->next)
  33. if (!strcmp(newuser->user, args[1])) {
  34. --
  35. 2.0.5