Pārlūkot izejas kodu

* 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 pirms 16 gadiem
vecāks
revīzija
995514ae7d
1 mainītis faili ar 4 papildinājumiem un 3 dzēšanām
  1. +4
    -3
      pipi/codec/modular.c

+ 4
- 3
pipi/codec/modular.c Parādīt failu

@@ -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;
}

Notiek ielāde…
Atcelt
Saglabāt