diff stream/stream_dvd.c @ 22403:11e7787eb78b

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
author nicodvb
date Sat, 03 Mar 2007 13:16:31 +0000
parents da9d0425a72a
children 521cd55ab99b
line wrap: on
line diff
--- a/stream/stream_dvd.c	Sat Mar 03 13:10:31 2007 +0000
+++ b/stream/stream_dvd.c	Sat Mar 03 13:16:31 2007 +0000
@@ -795,10 +795,11 @@
     /* 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);