[MPlayer-cvslog] r22421 - trunk/stream/stream_dvd.c

nicodvb subversion at mplayerhq.hu
Sat Mar 3 14:16:31 CET 2007


Author: nicodvb
Date: Sat Mar  3 14:16:31 2007
New Revision: 22421

Modified:
   trunk/stream/stream_dvd.c

Log:
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



Modified: trunk/stream/stream_dvd.c
==============================================================================
--- trunk/stream/stream_dvd.c	(original)
+++ trunk/stream/stream_dvd.c	Sat Mar  3 14:16:31 2007
@@ -795,10 +795,11 @@ static int open_s(stream_t *stream,int m
     /* 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);



More information about the MPlayer-cvslog mailing list