patch-index_c 1021 B

12345678910111213141516171819202122232425262728293031
  1. $OpenBSD: patch-index_c,v 1.1.1.1 2001/02/06 11:50:24 wilfried Exp $
  2. --- index.c.orig Sun Feb 14 10:50:42 1999
  3. +++ index.c Mon Feb 5 08:28:36 2001
  4. @@ -117,7 +117,7 @@ idx_find_entry( char *file, int ntracks,
  5. /*
  6. * Search for the first matching entry.
  7. */
  8. - sprintf(keyval, "%07d", tracks[ntracks - 1] - fuzz);
  9. + snprintf(keyval, sizeof(keyval), "%07d", tracks[ntracks - 1] - fuzz);
  10. key.data = keyval;
  11. key.size = 7;
  12. if (c = (index->seq)(index, &key, &data, R_CURSOR))
  13. @@ -249,7 +249,7 @@ idx_delete_entry(char *file, int track,
  14. /*
  15. * Search for the first matching entry.
  16. */
  17. - sprintf(keyval, "%07d", track - fuzz);
  18. + snprintf(keyval, sizeof(keyval), "%07d", track - fuzz);
  19. key.data = keyval;
  20. key.size = 7;
  21. if (c = (index->seq)(index, &key, &data, R_CURSOR))
  22. @@ -354,7 +354,7 @@ idx_write_entry( char *file, int track,
  23. key.data = keyval;
  24. key.size = 7;
  25. - sprintf(keyval, "%07d", track);
  26. + snprintf(keyval, sizeof(keyval), "%07d", track);
  27. status = (index->put)(index, &key, &data, 0);