Re: Fixing a long standing bug in view.c



* Pavel Roskin (proski gnu org) [20030226 19:08]:

> I've applied a much simple patch for this:
> 
> /* Make sure view->s.st_size is not truncated when passed to g_malloc */
> if ((gulong) view->s.st_size == view->s.st_size)
>     view->data = (unsigned char *) g_malloc ((gulong) view->s.st_size);
> 

Yes, this sure is much simpler :) Just don't forget to view->data=NULL in
the else branch as otherwise you'll get a segfault here:

       if (view->data != NULL)
            g_free (view->data);

> Thank you for reporting the problem!

You're welcome. I had to fix this anyway to get a working mc package for
the next version of SuSE Linux, and a fix accepted upstream is one fix less
I have to maintain :)

Philipp

-- 
Philipp Thomas <pthomas suse de>
SuSE Linux AG, Deutschherrnstr. 15-19, D-90429 Nuremberg, Germany



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]