From 5caf4aa1b92b6b4aadd3e94cd3a210f62c231dd1 Mon Sep 17 00:00:00 2001 From: nicodvb Date: Sat, 3 Mar 2007 13:16:31 +0000 Subject: replaced 1 instances of sprintf() with snprintf(); patch by njkain gmail com. This patch is intended to render code easier to audit against buffer oveflows git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@22421 b3059339-0415-0410-9bf9-f77b7e298cf2 --- stream/stream_dvd.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'stream/stream_dvd.c') diff --git a/stream/stream_dvd.c b/stream/stream_dvd.c index b23a5c9609..d3decc3a20 100644 --- a/stream/stream_dvd.c +++ b/stream/stream_dvd.c @@ -795,10 +795,11 @@ static int open_s(stream_t *stream,int mode, void* opts, int* file_format) { /* Dynamic DVD drive selection on Darwin */ if(!strcmp(dvd_device, "/dev/rdiskN")) { int i; - char *temp_device = malloc(strlen(dvd_device)+1); + size_t len = strlen(dvd_device); + char *temp_device = malloc(len); for (i = 1; i < 10; i++) { - sprintf(temp_device, "/dev/rdisk%d", i); + snprintf(temp_device, len, "/dev/rdisk%d", i); dvd = DVDOpen(temp_device); if(!dvd) { mp_msg(MSGT_OPEN,MSGL_ERR,MSGTR_CantOpenDVD,temp_device); -- cgit v1.2.3