patch-gnats_index_c 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. $OpenBSD: patch-gnats_index_c,v 1.1 2003/08/25 23:35:06 brad Exp $
  2. --- gnats/index.c.orig Wed Mar 17 16:45:38 1999
  3. +++ gnats/index.c Wed Jul 2 13:23:13 2003
  4. @@ -33,8 +33,9 @@ time_t index_mtime;
  5. char *index_filename = (char *)NULL;
  6. void
  7. -create_index_entry (buf)
  8. +create_index_entry (buf, bufsize)
  9. char *buf;
  10. + size_t bufsize;
  11. {
  12. char *resp, *r;
  13. char *tim;
  14. @@ -96,7 +97,8 @@ create_index_entry (buf)
  15. *r = '\0';
  16. #ifdef GNATS_RELEASE_BASED
  17. - sprintf (buf, "%s/%s|%s|%s|%s|%s|%s|%s|%d|%s|%s|%d|%d|%d|%s|%s|%s|%s\n",
  18. + snprintf (buf, bufsize,
  19. + "%s/%s|%s|%s|%s|%s|%s|%s|%d|%s|%s|%d|%d|%d|%s|%s|%s|%s\n",
  20. field_value (CATEGORY), field_value (NUMBER), field_value (SUBMITTER),
  21. resp, field_value (STATE), field_value (CONFIDENTIAL),
  22. field_value (SEVERITY), field_value (PRIORITY),
  23. @@ -105,7 +107,8 @@ create_index_entry (buf)
  24. field_value (CLASS), field_value (ORIGINATOR),
  25. field_value (RELEASE), field_value (SYNOPSIS));
  26. #else
  27. - sprintf (buf, "%s/%s|%s|%s|%s|%s|%s|%s|%d|%d|%d|%s|%s|%s|%s\n",
  28. + snprintf (buf, bufsize,
  29. + "%s/%s|%s|%s|%s|%s|%s|%s|%d|%d|%d|%s|%s|%s|%s\n",
  30. field_value (CATEGORY), field_value (NUMBER), field_value (SUBMITTER),
  31. resp, field_value (STATE), field_value (CONFIDENTIAL),
  32. field_value (SEVERITY), field_value (PRIORITY),
  33. @@ -399,7 +402,7 @@ open_index ()
  34. if (! index_filename)
  35. {
  36. index_filename = (char *) xmalloc (PATH_MAX);
  37. - sprintf (index_filename, "%s/gnats-adm/%s", gnats_root, INDEX);
  38. + snprintf (index_filename, PATH_MAX, "%s/gnats-adm/%s", gnats_root, INDEX);
  39. }
  40. fp = fopen (index_filename, "r");
  41. @@ -478,7 +481,7 @@ get_category (p)
  42. return NULL;
  43. path = (char *) xmalloc (PATH_MAX);
  44. - sprintf (path, "%s/%s/%s", gnats_root, category, p);
  45. + snprintf (path, PATH_MAX, "%s/%s/%s", gnats_root, category, p);
  46. return path;
  47. }