patch-cdinfo_c 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. $OpenBSD: patch-cdinfo_c,v 1.1.1.1 2001/02/06 11:50:24 wilfried Exp $
  2. --- cdinfo.c.orig Thu May 27 08:54:50 1999
  3. +++ cdinfo.c Mon Feb 5 08:24:02 2001
  4. @@ -304,32 +304,32 @@ listentry( int num )
  5. {
  6. if (cd->trk[num].section > 9)
  7. {
  8. - sprintf(tracknum, "%*d.%d", digits,
  9. + snprintf(tracknum, sizeof(tracknum), "%*d.%d", digits,
  10. cd->trk[num].track,
  11. cd->trk[num].section);
  12. } else {
  13. if (cd->trk[num].section)
  14. {
  15. - sprintf(tracknum, "%*d.%*d", digits,
  16. + snprintf(tracknum, sizeof(tracknum), "%*d.%*d", digits,
  17. cd->trk[num].track, sdigits,
  18. cd->trk[num].section);
  19. } else {
  20. - sprintf(tracknum, "%*d%*s", digits,
  21. + snprintf(tracknum, sizeof(tracknum), "%*d%*s", digits,
  22. cd->trk[num].track,
  23. 2 - sdigits, " ");
  24. /* 2 - sdigits - big_spaces, " ");*/
  25. }
  26. }
  27. } else {
  28. - sprintf(tracknum, "%*d", digits, cd->trk[num].track);
  29. + snprintf(tracknum, sizeof(tracknum), "%*d", digits, cd->trk[num].track);
  30. }
  31. if (cd->trk[num].data)
  32. {
  33. - sprintf(buf, "%s) %3dMB %s", tracknum,
  34. + snprintf(buf, sizeof(buf), "%s) %3dMB %s", tracknum,
  35. cd->trk[num].length / 1024, name);
  36. } else {
  37. - sprintf(buf, "%s) %02d:%02d %s", tracknum,
  38. + snprintf(buf, sizeof(buf), "%s) %02d:%02d %s", tracknum,
  39. cd->trk[num].length / 60,
  40. cd->trk[num].length % 60, name);
  41. }
  42. @@ -544,11 +544,11 @@ stash_cdinfo(char *artist, char *cdname,
  43. {
  44. if (strcmp(cd->artist, artist))
  45. info_modified = 1;
  46. - strcpy(cd->artist, artist);
  47. + strlcpy(cd->artist, artist, sizeof(cd->artist));
  48. if (strcmp(cd->cdname, cdname))
  49. info_modified = 1;
  50. - strcpy(cd->cdname, cdname);
  51. + strlcpy(cd->cdname, cdname, sizeof(cd->cdname));
  52. if (!!cd->autoplay != !!autoplay)
  53. info_modified = 1;