patch-mpg123ctl_c 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. $OpenBSD: patch-mpg123ctl_c,v 1.3 2003/06/16 19:01:55 avsm Exp $
  2. --- mpg123ctl.c.orig Mon Apr 3 01:18:43 2000
  3. +++ mpg123ctl.c Mon Jun 16 18:39:10 2003
  4. @@ -97,12 +97,12 @@ void set_playlist()
  5. dp = opendir(new_directory);
  6. while (new_directory && (strcmp(new_directory, directory) != 0) &&
  7. (dp == NULL)) {
  8. - strcpy(directory, new_directory);
  9. + strlcpy(directory, new_directory, strlen(directory) + 1);
  10. new_directory = (char *) next_mp3dir();
  11. dp = opendir(new_directory);
  12. }
  13. if (new_directory)
  14. - strcpy(directory, new_directory);
  15. + strlcpy(directory, new_directory, strlen(directory) + 1);
  16. }
  17. if (dp != NULL) {
  18. show_directory_name();
  19. @@ -111,7 +111,7 @@ void set_playlist()
  20. entry = readdir(dp);
  21. while (entry != NULL) {
  22. if (strstr(entry->d_name, mp3ext)) {
  23. - sprintf(filename, "%s/%s", directory, entry->d_name);
  24. + snprintf(filename, sizeof(filename), "%s/%s", directory, entry->d_name);
  25. insert_song(num_songs, entry->d_name, filename);
  26. num_songs++;
  27. }
  28. @@ -178,8 +178,8 @@ void play_next()
  29. song = get_song(rand_song_num[next_song]);
  30. }
  31. if (song) {
  32. - strcpy(title, song->title);
  33. - strcat(title, " ");
  34. + strlcpy(title, song->title, sizeof(title));
  35. + strlcat(title, " ", sizeof(title));
  36. scroll_pos = 0;
  37. do_scroll = 1;
  38. scroll_title();
  39. @@ -255,17 +255,17 @@ void init_ctl()
  40. void set_mpg123(char *s)
  41. {
  42. - strcpy(mpg123_cmd, s);
  43. + strlcpy(mpg123_cmd, s, sizeof(mpg123_cmd));
  44. }
  45. void set_mp3ext(char *s)
  46. {
  47. - strcpy(mp3ext, s);
  48. + strlcpy(mp3ext, s, sizeof(mp3ext));
  49. }
  50. void set_playlistext(char *s)
  51. {
  52. - strcpy(playlistext, s);
  53. + strlcpy(playlistext, s, sizeof(playlistext));
  54. }
  55. void set_alwaysscroll(char *s) {