123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- $OpenBSD: patch-mpg123ctl_c,v 1.3 2003/06/16 19:01:55 avsm Exp $
- --- mpg123ctl.c.orig Mon Apr 3 01:18:43 2000
- +++ mpg123ctl.c Mon Jun 16 18:39:10 2003
- @@ -97,12 +97,12 @@ void set_playlist()
- dp = opendir(new_directory);
- while (new_directory && (strcmp(new_directory, directory) != 0) &&
- (dp == NULL)) {
- - strcpy(directory, new_directory);
- + strlcpy(directory, new_directory, strlen(directory) + 1);
- new_directory = (char *) next_mp3dir();
- dp = opendir(new_directory);
- }
- if (new_directory)
- - strcpy(directory, new_directory);
- + strlcpy(directory, new_directory, strlen(directory) + 1);
- }
- if (dp != NULL) {
- show_directory_name();
- @@ -111,7 +111,7 @@ void set_playlist()
- entry = readdir(dp);
- while (entry != NULL) {
- if (strstr(entry->d_name, mp3ext)) {
- - sprintf(filename, "%s/%s", directory, entry->d_name);
- + snprintf(filename, sizeof(filename), "%s/%s", directory, entry->d_name);
- insert_song(num_songs, entry->d_name, filename);
- num_songs++;
- }
- @@ -178,8 +178,8 @@ void play_next()
- song = get_song(rand_song_num[next_song]);
- }
- if (song) {
- - strcpy(title, song->title);
- - strcat(title, " ");
- + strlcpy(title, song->title, sizeof(title));
- + strlcat(title, " ", sizeof(title));
- scroll_pos = 0;
- do_scroll = 1;
- scroll_title();
- @@ -255,17 +255,17 @@ void init_ctl()
- void set_mpg123(char *s)
- {
-
- - strcpy(mpg123_cmd, s);
- + strlcpy(mpg123_cmd, s, sizeof(mpg123_cmd));
- }
-
- void set_mp3ext(char *s)
- {
- - strcpy(mp3ext, s);
- + strlcpy(mp3ext, s, sizeof(mp3ext));
- }
-
- void set_playlistext(char *s)
- {
- - strcpy(playlistext, s);
- + strlcpy(playlistext, s, sizeof(playlistext));
- }
-
- void set_alwaysscroll(char *s) {
|