Bladeren bron

* Added bound-checking to file extension detection

git-svn-id: file:///srv/caca.zoy.org/var/lib/svn/libpipi/trunk@3085 92316355-f0b4-4df1-b90c-862c8a59935f
remotes/tiles
jylam 16 jaren geleden
bovenliggende
commit
995514ae7d
1 gewijzigde bestanden met toevoegingen van 4 en 3 verwijderingen
  1. +4
    -3
      pipi/codec/modular.c

+ 4
- 3
pipi/codec/modular.c Bestand weergeven

@@ -27,8 +27,9 @@ pipi_image_t *pipi_load_modular(const char *name)

int pipi_save_modular(pipi_image_t *img, const char *name)
{
if(!strncasecmp(&name[strlen(name) - 3], "jpg", 3) ||
!strncasecmp(&name[strlen(name) - 4], "jpeg", 4) )
return pipi_save_jpeg(img, name);
if(strlen(name) >= 4)
if(!strncasecmp(&name[strlen(name) - 3], "jpg", 3) ||
!strncasecmp(&name[strlen(name) - 4], "jpeg", 4) )
return pipi_save_jpeg(img, name);
return -1;
}

Laden…
Annuleren
Opslaan