patch-gnats_gen-index_c 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. $OpenBSD: patch-gnats_gen-index_c,v 1.1 2003/08/25 23:35:06 brad Exp $
  2. --- gnats/gen-index.c.orig Tue Sep 21 17:18:39 1999
  3. +++ gnats/gen-index.c Wed Jul 2 13:23:13 2003
  4. @@ -118,7 +118,7 @@ do_category (c)
  5. return;
  6. }
  7. - sprintf (path, "%s/%s/", gnats_root, c);
  8. + snprintf (path, len + 9, "%s/%s/", gnats_root, c);
  9. /* Process each file in the directory; ignore files that have periods
  10. in their names; either they're the . and .. dirs, or they're a
  11. @@ -127,7 +127,7 @@ do_category (c)
  12. if (strchr (next->d_name, '.') == NULL)
  13. {
  14. p = path + len - 1;
  15. - strcat (p, next->d_name);
  16. + strlcat (p, next->d_name, path + len + 9 - p);
  17. fp = fopen (path, "r");
  18. if (fp == (FILE *) NULL)
  19. @@ -150,7 +150,7 @@ do_category (c)
  20. read_pr (fp, 1);
  21. fclose (fp);
  22. - create_index_entry (line);
  23. + create_index_entry (line, STR_MAXLONG);
  24. if (sort_numerical == TRUE)
  25. {
  26. @@ -256,7 +256,7 @@ get_categories ()
  27. Categories *c;
  28. if (! catfile)
  29. - sprintf (path, "%s/gnats-adm/%s", gnats_root, CATEGORIES);
  30. + snprintf (path, PATH_MAX, "%s/gnats-adm/%s", gnats_root, CATEGORIES);
  31. else
  32. path = catfile;