Changeset 4376 for zzuf


Ignore:
Timestamp:
Feb 27, 2010, 8:27:41 PM (10 years ago)
Author:
Sam Hocevar
Message:

Add fortify versions of libc calls to zzat.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • zzuf/trunk/src/zzat.c

    r4364 r4376  
    479479        else if (PARSECMD("fgets ( %li )", &l1))
    480480            MY_FREAD(s = fgets(tmp, l1, f), tmp, s ? strlen(tmp) : 0);
     481#if defined HAVE___FGETS_CHK
     482        else if (PARSECMD("__fgets_chk ( %li )", &l1))
     483            MY_FREAD(s = __fgets_chk(tmp, l1, l1, f), tmp, s ? strlen(tmp) : 0);
     484#endif
    481485#if defined HAVE__IO_GETC
    482486        else if (PARSECMD("_IO_getc ( )"))
    483487            MY_FREAD(ch = (n = _IO_getc(f)), &ch, (n != EOF));
    484488#endif
     489#if defined HAVE___FREAD_CHK
     490        else if (PARSECMD("__fread_chk ( %li , %li )", &l1, &l2))
     491            MY_FREAD(l = __fread_chk(tmp, l1 * l2, l1, l2, f), tmp, l > 0 ? l * l1 : 0);
     492#endif
    485493#if defined HAVE_FREAD_UNLOCKED
    486494        else if (PARSECMD("fread_unlocked ( %li , %li )", &l1, &l2))
    487495            MY_FREAD(l = fread_unlocked(tmp, l1, l2, f), tmp, l > 0 ? l * l1 : 0);
    488496#endif
     497#if defined HAVE___FREAD_UNLOCKED_CHK
     498        else if (PARSECMD("__fread_unlocked_chk ( %li , %li )", &l1, &l2))
     499            MY_FREAD(l = __fread_unlocked_chk(tmp, l1 * l2, l1, l2, f), tmp, l > 0 ? l * l1 : 0);
     500#endif
    489501#if defined HAVE_FGETS_UNLOCKED
    490502        else if (PARSECMD("fgets_unlocked ( %li )", &l1))
    491503            MY_FREAD(s = fgets_unlocked(tmp, l1, f), tmp, s ? strlen(tmp) : 0);
     504#endif
     505#if defined HAVE___FGETS_UNLOCKED_CHK
     506        else if (PARSECMD("__fgets_unlocked_chk ( %li )", &l1))
     507            MY_FREAD(s = __fgets_unlocked_chk(tmp, l1, l1, f), tmp, s ? strlen(tmp) : 0);
    492508#endif
    493509#if defined HAVE_GETC_UNLOCKED
     
    722738    "fgetc", "()", "get one character",
    723739    "fgets", "(<int>)", "read one line no longer than <int> bytes",
     740#if defined HAVE___FGETS_CHK
     741    "__fgets_chk", "(<int>)", "same as fgets(), fortified version",
     742#endif
    724743#if defined HAVE__IO_GETC
    725744    "_IO_getc", "()", "get one character",
    726745#endif
     746#if defined HAVE___FREAD_CHK
     747    "__fread_chk", "(<inta>,<intb>)", "same as fread(), fortified version",
     748#endif
    727749#if defined HAVE_FREAD_UNLOCKED
    728750    "fread_unlocked", "(<inta>,<intb>)", "same as fread(), unlocked I/O version",
    729751#endif
     752#if defined HAVE___FREAD_UNLOCKED_CHK
     753    "__fread_unlocked_chk", "(<inta>,<intb>)", "same as fread_unlocked(), fortified version",
     754#endif
    730755#if defined HAVE_FGETS_UNLOCKED
    731756    "fgets_unlocked", "(<int>)", "same as fgets(), unlocked I/O version",
     757#endif
     758#if defined HAVE___FGETS__UNLOCKED_CHK
     759    "__fgets_unlocked_chk", "(<int>)", "same as fgets_unlocked(), fortified version",
    732760#endif
    733761#if defined HAVE_GETC_UNLOCKED
Note: See TracChangeset for help on using the changeset viewer.