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

Reimar Döffinger Reimar.Doeffinger at stud.uni-karlsruhe.de
Sat Mar 3 14:44:11 CET 2007


Hello,
On Sat, Mar 03, 2007 at 02:45:39PM +0100, Nico Sabbi wrote:
> Reimar Döffinger wrote:
> >On Sat, Mar 03, 2007 at 02:16:31PM +0100, nicodvb wrote:
> >
> >>    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);
> >
> >Was this tested? In this block, dvd_device is "/dev/rdiskN", so len is
> >11, thus temp_device will always be "/dev/rdisk" ???
> 
> right, I'm sorry; I applied the wrong patch. Fixed

No problem, you just gave me another point to illustrate why I think
these kind of patches are no good.
Either they are done too quickly and break stuff or they are done
properly in which case we could have spend to on something that actually
does improve safety, with cleanup of asf or asx parse. And the critical
code in MPlayer really isn't the string handling functions first of all,
most of them deal with user input, the demuxers and decoders are
critical part, even though they use few of any of those functions.

Greetings,
Reimar Döffinger



More information about the MPlayer-cvslog mailing list