Skip to content
This repository has been archived by the owner on Dec 1, 2017. It is now read-only.
Permalink
Browse files Browse the repository at this point in the history
* libtiff/tif_{unix,vms,win32}.c (_TIFFmalloc): ANSI C does not
require malloc() to return NULL pointer if requested allocation
size is zero.  Assure that _TIFFmalloc does.
  • Loading branch information
bfriesen committed Nov 18, 2012
1 parent 882d392 commit 3c5eb8b
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 0 deletions.
6 changes: 6 additions & 0 deletions ChangeLog
@@ -1,3 +1,9 @@
2012-11-18 Bob Friesenhahn <bfriesen@simple.dallas.tx.us>

* libtiff/tif_{unix,vms,win32}.c (_TIFFmalloc): ANSI C does not
require malloc() to return NULL pointer if requested allocation
size is zero. Assure that _TIFFmalloc does.

2012-11-01 Frank Warmerdam <warmerdam@pobox.com>

* tools/ppm2tiff.c: avoid zero size buffer vulnerability.
Expand Down
3 changes: 3 additions & 0 deletions libtiff/tif_unix.c
Expand Up @@ -257,6 +257,9 @@ TIFFOpenW(const wchar_t* name, const char* mode)
void*
_TIFFmalloc(tmsize_t s)
{
if (s == 0)
return ((void *) NULL);

return (malloc((size_t) s));
}

Expand Down
3 changes: 3 additions & 0 deletions libtiff/tif_vms.c
Expand Up @@ -264,6 +264,9 @@ TIFFOpen(const char* name, const char* mode)
tdata_t
_TIFFmalloc(tsize_t s)
{
if (s == 0)
return ((void *) NULL);

return (malloc((size_t) s));
}

Expand Down
3 changes: 3 additions & 0 deletions libtiff/tif_win32.c
Expand Up @@ -329,6 +329,9 @@ TIFFOpenW(const wchar_t* name, const char* mode)
void*
_TIFFmalloc(tmsize_t s)
{
if (s == 0)
return ((void *) NULL);

return (malloc((size_t) s));
}

Expand Down

0 comments on commit 3c5eb8b

Please sign in to comment.