Changeset 3085 for libpipi


Ignore:
Timestamp:
Oct 24, 2008, 2:33:13 PM (12 years ago)
Author:
Jean-Yves Lamoureux
Message:
  • Added bound-checking to file extension detection
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libpipi/trunk/pipi/codec/modular.c

    r3083 r3085  
    2828int pipi_save_modular(pipi_image_t *img, const char *name)
    2929{
    30     if(!strncasecmp(&name[strlen(name) - 3], "jpg",  3) ||
    31        !strncasecmp(&name[strlen(name) - 4], "jpeg", 4) )
    32         return pipi_save_jpeg(img, name);
     30    if(strlen(name) >= 4)
     31        if(!strncasecmp(&name[strlen(name) - 3], "jpg",  3) ||
     32           !strncasecmp(&name[strlen(name) - 4], "jpeg", 4) )
     33            return pipi_save_jpeg(img, name);
    3334    return -1;
    3435}
Note: See TracChangeset for help on using the changeset viewer.