Package: sdl-mixer1.2 / 1.2.12-15

02_hurd.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
Description: Fix FTBFS on Hurd
 Introduced in 1.2.6-3 (Tue, 31 Jul 2007 14:16:36 +0200).
Author: Samuel Thibault <samuel.thibault@ens-lyon.org>
Last-Update: 2012-01-20
Bug-Debian: http://bugs.debian.org/428892
--- a/music_cmd.c
+++ b/music_cmd.c
@@ -53,10 +53,8 @@
 		Mix_SetError("Out of memory");
 		return(NULL);
 	}
-	strncpy(music->file, file, (sizeof music->file)-1);
-	music->file[(sizeof music->file)-1] = '\0';
-	strncpy(music->cmd, cmd, (sizeof music->cmd)-1);
-	music->cmd[(sizeof music->cmd)-1] = '\0';
+	music->file = strdup(file);
+	music->cmd = strdup(cmd);
 	music->pid = 0;
 
 	/* We're done */
@@ -155,7 +153,7 @@
 
 	    /* Child process - executes here */
 	    case 0: {
-		    char command[PATH_MAX];
+		    char *command;
 		    char **argv;
 
 		    /* Unblock signals in case we're called from a thread */
@@ -166,11 +164,12 @@
 		    }
 
 		    /* Execute the command */
-		    strcpy(command, music->cmd);
+		    command = strdup(music->cmd);
 		    argv = parse_args(command, music->file);
 		    if ( argv != NULL ) {
 			execvp(argv[0], argv);
 		    }
+		    SDL_free(command);
 
 		    /* exec() failed */
 		    perror(argv[0]);
@@ -219,6 +218,8 @@
 /* Close the given music stream */
 void MusicCMD_FreeSong(MusicCMD *music)
 {
+	SDL_free(music->file);
+	SDL_free(music->cmd);
 	SDL_free(music);
 }
 
--- a/music_cmd.h
+++ b/music_cmd.h
@@ -30,8 +30,8 @@
 # include <linux/limits.h>
 #endif
 typedef struct {
-	char file[PATH_MAX];
-	char cmd[PATH_MAX];
+	char *file;
+	char *cmd;
 	pid_t pid;
 } MusicCMD;