summaryrefslogtreecommitdiffstats
path: root/stream
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2012-11-19 00:22:43 +0100
committerwm4 <wm4@nowhere>2012-11-20 18:00:15 +0100
commit9085b85729bb8eb8e4b96195f651308e912b443f (patch)
treee90bb743530d04dfe053ad46ec5451756a1009e2 /stream
parentefaa73cc7333cee40555a61f7bd829c6deb64e63 (diff)
downloadmpv-9085b85729bb8eb8e4b96195f651308e912b443f.tar.bz2
mpv-9085b85729bb8eb8e4b96195f651308e912b443f.tar.xz
stream: fix dvd:// + cache crashing
The language string was dynamically allocated, which completely fails if the cache is forked (which it usually is). Change it back to a fixed length string, like the original code had it.
Diffstat (limited to 'stream')
-rw-r--r--stream/stream.h2
-rw-r--r--stream/stream_bluray.c4
-rw-r--r--stream/stream_dvd.c2
3 files changed, 5 insertions, 3 deletions
diff --git a/stream/stream.h b/stream/stream.h
index 9bb6da749b..87cb6c64db 100644
--- a/stream/stream.h
+++ b/stream/stream.h
@@ -100,7 +100,7 @@
struct stream_lang_req {
int type; // STREAM_AUDIO, STREAM_SUB
int id;
- char *name;
+ char name[50];
};
typedef enum {
diff --git a/stream/stream_bluray.c b/stream/stream_bluray.c
index 5f380458c7..8ee69aaa80 100644
--- a/stream/stream_bluray.c
+++ b/stream/stream_bluray.c
@@ -30,6 +30,8 @@
*/
#include <libbluray/bluray.h>
+#include <string.h>
+#include <assert.h>
#include "config.h"
#include "libavutil/common.h"
@@ -215,7 +217,7 @@ static int bluray_stream_control(stream_t *s, int cmd, void *arg)
}
while (count-- > 0) {
if (si->pid == req->id) {
- req->name = talloc_strndup(NULL, si->lang, 4);
+ snprintf(req->name, sizeof(req->name), "%.4s", si->lang);
bd_free_title_info(ti);
return STREAM_OK;
}
diff --git a/stream/stream_dvd.c b/stream/stream_dvd.c
index 4554b2c2cc..b30092134c 100644
--- a/stream/stream_dvd.c
+++ b/stream/stream_dvd.c
@@ -707,7 +707,7 @@ static int control(stream_t *stream,int cmd,void* arg)
}
if (!lang)
break;
- req->name = talloc_strdup(NULL, (char[]) {lang >> 8, lang, 0});
+ snprintf(req->name, sizeof(req->name), "%c%c", lang >> 8, lang);
return STREAM_OK;
}
}