Changeset 2355 for zzuf/trunk


Ignore:
Timestamp:
Jun 10, 2008, 6:21:22 PM (12 years ago)
Author:
Sam Hocevar
Message:
  • Fix a crash in the realloc() wrapper occurring when dlsym() or dlopen() call realloc() with a NULL pointer.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • zzuf/trunk/src/lib-mem.c

    r2354 r2355  
    174174    {
    175175        ret = dummy_buffer + dummy_offset;
    176         memcpy(ret, ptr, size);
     176        /* XXX: If ptr is NULL, we don't copy anything. If it is non-NULL, we
     177         * copy everything even if it is too big, we don't have anything to
     178         * overflow really. */
     179        if(ptr)
     180            memcpy(ret, ptr, size);
    177181        dummy_offset += (size + 7) * 8;
    178182        debug("%s(%p, %li) = %p", __func__, ptr, (long int)size, ret);
Note: See TracChangeset for help on using the changeset viewer.