Ignore:
Timestamp:
Jan 25, 2007, 12:40:27 PM (14 years ago)
Author:
Sam Hocevar
Message:
  • Implemented -b/--bytes to restrict fuzzing to specific offsets.
File:
1 edited

Legend:

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

    r1704 r1705  
    126126    {
    127127#   if defined HAVE_REGEX_H
    128 #       define OPTSTR "AB:cC:dD:E:F:iI:mM:nP:qr:R:s:ST:vxhV"
     128#       define OPTSTR "Ab:B:cC:dD:E:F:iI:mM:nP:qr:R:s:ST:vxhV"
    129129#   else
    130 #       define OPTSTR "AB:C:dD:F:imM:nP:qr:R:s:ST:vxhV"
     130#       define OPTSTR "Ab:B:C:dD:F:imM:nP:qr:R:s:ST:vxhV"
    131131#   endif
    132132#   if defined HAVE_GETOPT_LONG
     
    137137            /* Long option, needs arg, flag, short option */
    138138            { "autoinc",     0, NULL, 'A' },
     139            { "bytes",       1, NULL, 'b' },
    139140            { "max-bytes",   1, NULL, 'B' },
    140141#if defined HAVE_REGEX_H
     
    181182            setenv("ZZUF_AUTOINC", "1", 1);
    182183            break;
     184        case 'b': /* --bytes */
     185            opts->bytes = optarg;
     186            break;
    183187        case 'B': /* --max-bytes */
    184188            opts->maxbytes = atoi(optarg);
     
    297301    if(optind >= argc)
    298302    {
     303        if(opts->bytes)
     304            _zz_bytes(opts->bytes);
     305
     306        /* FIXME: protect and refuse are ignored */
     307
    299308        if(opts->endseed != opts->seed + 1)
    300309        {
     
    335344#endif
    336345
     346    if(opts->bytes)
     347        setenv("ZZUF_BYTES", opts->bytes, 1);
    337348    if(opts->protect)
    338349        setenv("ZZUF_PROTECT", opts->protect, 1);
     
    10211032#if defined HAVE_REGEX_H
    10221033    printf("Usage: zzuf [-AcdimnqSvx] [-s seed|-s start:stop] [-r ratio|-r min:max]\n");
    1023     printf("                          [-D delay] [-F forks] [-C crashes] [-B bytes]\n");
    1024     printf("                          [-T seconds] [-M bytes] [-P protect] [-R refuse]\n");
    1025     printf("                          [-I include] [-E exclude] [PROGRAM [--] [ARGS]...]\n");
    10261034#else
    10271035    printf("Usage: zzuf [-AdimnqSvx] [-s seed|-s start:stop] [-r ratio|-r min:max]\n");
    1028     printf("                         [-D delay] [-F forks] [-C crashes] [-B bytes]\n");
    1029     printf("                         [-T seconds] [-M bytes] [-P protect] [-R refuse]\n");
    1030     printf("                         [PROGRAM [--] [ARGS]...]\n");
     1036#endif
     1037    printf("                  [-D delay] [-F forks] [-C crashes] [-B bytes] [-T seconds]\n");
     1038    printf("                  [-M bytes] [-b ranges] [-P protect] [-R refuse]\n");
     1039#if defined HAVE_REGEX_H
     1040    printf("                  [-I include] [-E exclude] [PROGRAM [--] [ARGS]...]\n");
     1041#else
     1042    printf("                  [PROGRAM [--] [ARGS]...]\n");
    10311043#endif
    10321044#   if defined HAVE_GETOPT_LONG
     
    10421054#   if defined HAVE_GETOPT_LONG
    10431055    printf("  -A, --autoinc             increment seed each time a new file is opened\n");
     1056    printf("  -b, --bytes <ranges>      only fuzz bytes at offsets within <ranges>\n");
    10441057    printf("  -B, --max-bytes <n>       kill children that output more than <n> bytes\n");
    10451058#if defined HAVE_REGEX_H
     
    10771090#   else
    10781091    printf("  -A               increment seed each time a new file is opened\n");
     1092    printf("  -b <ranges>      only fuzz bytes at offsets within <ranges>\n");
    10791093    printf("  -B <n>           kill children that output more than <n> bytes\n");
    10801094#if defined HAVE_REGEX_H
Note: See TracChangeset for help on using the changeset viewer.