From: Han Boetes Subject: mg: 2 more strdup problems. To: tech@openbsd.org Date: Sat, 28 Feb 2026 21:57:16 +0100 Hello all, While reviewing the fix Omar applied to echo.c, I noticed the same pattern in two more places. The following patch aims to fix these problems. Sorry for the mangling, no idea how to fix that. BR Han --- a/fileio.c +++ b/fileio.c @@ -555,8 +555,14 @@              free(current);              continue;          } -        current->l_next = last;          current->l_name = strdup(fl_name); +        if (current->l_name == NULL) { +            free(current); +            free_file_list(last); +            closedir(dirp); +            return (NULL); +        } +        current->l_next = last;          last = current;      }      closedir(dirp); --- a/funmap.c +++ b/funmap.c @@ -312,6 +312,11 @@                  return (NULL);              }              el->l_name = strdup(fn->fn_name); +            if (el->l_name == NULL) { +                free(el); +                free_file_list(head); +                return (NULL); +            }              el->l_next = head;              head = el;          }