DragonFly BSD
DragonFly commits List (threaded) for 2012-11
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

git: getline(3): Fix segfault caused by NULL pointer


From: Antonio Huete Jimenez <tuxillo@xxxxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 7 Nov 2012 14:39:10 -0800 (PST)

commit 50b19aeb57b413e29e1eff28311433ea7d78f4a3
Author: John Marino <netbsd@marino.st>
Date:   Wed Nov 7 21:15:35 2012 +0100

    getline(3): Fix segfault caused by NULL pointer
    
    This fixes a segfault seen with pkg's audit function, and effectively syncs
    getdelim with FreeBSD.
    
    Taken-from: FreeBSD SVN 197752 (04 OCT 2009)
    
    - Tolerate applications that pass a NULL pointer for the buffer and
      claim that the capacity of the buffer is nonzero.
    
    - If an application passes in a non-NULL buffer pointer and claims the
      buffer has zero capacity, we should free (well, realloc) it anyway.
      It could have been obtained from malloc(0), so failing to free it
      would be a small memory leak.

Summary of changes:
 lib/libc/stdio/getdelim.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/50b19aeb57b413e29e1eff28311433ea7d78f4a3


-- 
DragonFly BSD source repository



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