misc: minor fixes for compilation warnings.
This commit is contained in:
+2
-1
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* zzuf - general purpose fuzzer
|
||||
*
|
||||
* Copyright © 2006—2015 Sam Hocevar <sam@hocevar.net>
|
||||
*
|
||||
* This program is free software. It comes without any warranty, to
|
||||
@@ -437,7 +438,7 @@ early_exit:
|
||||
|
||||
int64_t _zz_getpos(int fd)
|
||||
{
|
||||
int ret = 0;
|
||||
int64_t ret = 0;
|
||||
fd_lock();
|
||||
|
||||
if (fd < 0 || fd >= maxfd || fds[fd] == -1)
|
||||
|
||||
+20
-20
@@ -1,13 +1,13 @@
|
||||
/*
|
||||
* zzuf - general purpose fuzzer
|
||||
* Copyright (c) 2006-2010 Sam Hocevar <sam@hocevar.net>
|
||||
* All Rights Reserved
|
||||
*
|
||||
* Copyright © 2006—2015 Sam Hocevar <sam@hocevar.net>
|
||||
*
|
||||
* This program is free software. It comes without any warranty, to
|
||||
* the extent permitted by applicable law. You can redistribute it
|
||||
* and/or modify it under the terms of the Do What The Fuck You Want
|
||||
* To Public License, Version 2, as published by Sam Hocevar. See
|
||||
* http://sam.zoy.org/wtfpl/COPYING for more details.
|
||||
* and/or modify it under the terms of the Do What the Fuck You Want
|
||||
* to Public License, Version 2, as published by the WTFPL Task Force.
|
||||
* See http://www.wtfpl.net/ for more details.
|
||||
*/
|
||||
|
||||
/*
|
||||
@@ -194,44 +194,44 @@ static void readchars(unsigned char *table, char const *list)
|
||||
|
||||
for(tmp = list, a = b = -1; *tmp; tmp++)
|
||||
{
|
||||
int new;
|
||||
int ch;
|
||||
|
||||
if(*tmp == '\\' && tmp[1] == '\0')
|
||||
new = '\\';
|
||||
ch = '\\';
|
||||
else if(*tmp == '\\')
|
||||
{
|
||||
tmp++;
|
||||
if(*tmp == 'n')
|
||||
new = '\n';
|
||||
ch = '\n';
|
||||
else if(*tmp == 'r')
|
||||
new = '\r';
|
||||
ch = '\r';
|
||||
else if(*tmp == 't')
|
||||
new = '\t';
|
||||
ch = '\t';
|
||||
else if(tmp[0] >= '0' && tmp[0] <= '7' && tmp[1] >= '0'
|
||||
&& tmp[1] <= '7' && tmp[2] >= '0' && tmp[2] <= '7')
|
||||
{
|
||||
new = tmp[2] - '0';
|
||||
new |= (int)(tmp[1] - '0') << 3;
|
||||
new |= (int)(tmp[0] - '0') << 6;
|
||||
ch = tmp[2] - '0';
|
||||
ch |= (int)(tmp[1] - '0') << 3;
|
||||
ch |= (int)(tmp[0] - '0') << 6;
|
||||
tmp += 2;
|
||||
}
|
||||
else if((*tmp == 'x' || *tmp == 'X')
|
||||
&& tmp[1] && strchr(hex, tmp[1])
|
||||
&& tmp[2] && strchr(hex, tmp[2]))
|
||||
{
|
||||
new = ((int)(strchr(hex, tmp[1]) - hex) & 0xf) << 4;
|
||||
new |= (int)(strchr(hex, tmp[2]) - hex) & 0xf;
|
||||
ch = ((int)(strchr(hex, tmp[1]) - hex) & 0xf) << 4;
|
||||
ch |= (int)(strchr(hex, tmp[2]) - hex) & 0xf;
|
||||
tmp += 2;
|
||||
}
|
||||
else
|
||||
new = (unsigned char)*tmp; /* XXX: OK for \\, but what else? */
|
||||
ch = (unsigned char)*tmp; /* XXX: OK for \\, but what else? */
|
||||
}
|
||||
else
|
||||
new = (unsigned char)*tmp;
|
||||
ch = (unsigned char)*tmp;
|
||||
|
||||
if(a != -1 && b == '-' && a <= new)
|
||||
if(a != -1 && b == '-' && a <= ch)
|
||||
{
|
||||
while(a <= new)
|
||||
while(a <= ch)
|
||||
table[a++] = 1;
|
||||
a = b = -1;
|
||||
}
|
||||
@@ -240,7 +240,7 @@ static void readchars(unsigned char *table, char const *list)
|
||||
if(a != -1)
|
||||
table[a] = 1;
|
||||
a = b;
|
||||
b = new;
|
||||
b = ch;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/*
|
||||
* zzuf - general purpose fuzzer
|
||||
* Copyright (c) 2006-2010 Sam Hocevar <sam@hocevar.net>
|
||||
* All Rights Reserved
|
||||
*
|
||||
* Copyright © 2006—2015 Sam Hocevar <sam@hocevar.net>
|
||||
*
|
||||
* This program is free software. It comes without any warranty, to
|
||||
* the extent permitted by applicable law. You can redistribute it
|
||||
* and/or modify it under the terms of the Do What The Fuck You Want
|
||||
* To Public License, Version 2, as published by Sam Hocevar. See
|
||||
* http://sam.zoy.org/wtfpl/COPYING for more details.
|
||||
* and/or modify it under the terms of the Do What the Fuck You Want
|
||||
* to Public License, Version 2, as published by the WTFPL Task Force.
|
||||
* See http://www.wtfpl.net/ for more details.
|
||||
*/
|
||||
|
||||
/*
|
||||
@@ -46,8 +46,8 @@ extern void *_zz_dl_lib;
|
||||
typedef struct
|
||||
{
|
||||
char const *lib, *name;
|
||||
void **old;
|
||||
void *new;
|
||||
void **old_sym;
|
||||
void *new_sym;
|
||||
}
|
||||
zzuf_table_t;
|
||||
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/*
|
||||
* zzuf - general purpose fuzzer
|
||||
* Copyright (c) 2006-2010 Sam Hocevar <sam@hocevar.net>
|
||||
* All Rights Reserved
|
||||
*
|
||||
* Copyright © 2006—2015 Sam Hocevar <sam@hocevar.net>
|
||||
*
|
||||
* This program is free software. It comes without any warranty, to
|
||||
* the extent permitted by applicable law. You can redistribute it
|
||||
* and/or modify it under the terms of the Do What The Fuck You Want
|
||||
* To Public License, Version 2, as published by Sam Hocevar. See
|
||||
* http://sam.zoy.org/wtfpl/COPYING for more details.
|
||||
* and/or modify it under the terms of the Do What the Fuck You Want
|
||||
* to Public License, Version 2, as published by the WTFPL Task Force.
|
||||
* See http://www.wtfpl.net/ for more details.
|
||||
*/
|
||||
|
||||
/*
|
||||
@@ -441,7 +441,10 @@ FILE *NEW(__freopen64)(const char *path, const char *mode, FILE *stream)
|
||||
fd = fileno(stream); \
|
||||
if(!_zz_ready || !_zz_iswatched(fd) || !_zz_isactive(fd) \
|
||||
|| _zz_islocked(fd)) \
|
||||
return ORIG(rewind)(stream); \
|
||||
{ \
|
||||
ORIG(rewind)(stream); \
|
||||
return; \
|
||||
} \
|
||||
debug_stream("before", stream); \
|
||||
/* FIXME: ftell() will return -1 on a pipe such as stdin */ \
|
||||
oldpos = ZZ_FTELL(stream); \
|
||||
@@ -527,7 +530,7 @@ void NEW(rewind)(FILE *stream)
|
||||
do \
|
||||
{ \
|
||||
int64_t oldpos, newpos; \
|
||||
uint8_t *b = ptr;\
|
||||
uint8_t *b = (uint8_t *)ptr;\
|
||||
int oldcnt; \
|
||||
int fd; \
|
||||
LOADSYM(myfread); \
|
||||
|
||||
+8
-8
@@ -1,14 +1,14 @@
|
||||
/*
|
||||
* zzuf - general purpose fuzzer
|
||||
* Copyright (c) 2006-2012 Sam Hocevar <sam@hocevar.net>
|
||||
* 2012 Kévin Szkudłapski <kszkudlapski@quarkslab.com>
|
||||
* All Rights Reserved
|
||||
*
|
||||
* Copyright © 2006—2015 Sam Hocevar <sam@hocevar.net>
|
||||
* 2012 Kévin Szkudłapski <kszkudlapski@quarkslab.com>
|
||||
*
|
||||
* This program is free software. It comes without any warranty, to
|
||||
* the extent permitted by applicable law. You can redistribute it
|
||||
* and/or modify it under the terms of the Do What The Fuck You Want
|
||||
* To Public License, Version 2, as published by Sam Hocevar. See
|
||||
* http://sam.zoy.org/wtfpl/COPYING for more details.
|
||||
* and/or modify it under the terms of the Do What the Fuck You Want
|
||||
* to Public License, Version 2, as published by the WTFPL Task Force.
|
||||
* See http://www.wtfpl.net/ for more details.
|
||||
*/
|
||||
|
||||
/*
|
||||
@@ -409,12 +409,12 @@ static void insert_funcs(void)
|
||||
fprintf(stderr, "unable to get pointer to %s\n", diversion->name);
|
||||
continue;
|
||||
}
|
||||
if (hook_inline(old_api, diversion->new, &trampoline_api) < 0)
|
||||
if (hook_inline(old_api, diversion->new_sym, &trampoline_api) < 0)
|
||||
{
|
||||
fprintf(stderr, "hook_inline failed while hooking %s!%s\n", diversion->lib, diversion->name);
|
||||
continue;
|
||||
}
|
||||
*diversion->old = trampoline_api;
|
||||
*diversion->old_sym = trampoline_api;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -470,7 +470,7 @@ static int run(char const *sequence, char const *file)
|
||||
|
||||
/* FILE * reading functions */
|
||||
else if (PARSECMD("fread ( %li , %li )", &l1, &l2))
|
||||
MY_FREAD(l = fread(tmp, l1, l2, f), tmp, l > 0 ? l * l1 : 0);
|
||||
MY_FREAD(l = (ssize_t)fread(tmp, l1, l2, f), tmp, l > 0 ? l * l1 : 0);
|
||||
else if (PARSECMD("getc ( )"))
|
||||
MY_FREAD(ch = (n = getc(f)), &ch, (n != EOF));
|
||||
else if (PARSECMD("fgetc ( )"))
|
||||
|
||||
+8
-8
@@ -1,13 +1,13 @@
|
||||
/*
|
||||
* zzuf - general purpose fuzzer
|
||||
* Copyright (c) 2002-2010 Sam Hocevar <sam@hocevar.net>
|
||||
* All Rights Reserved
|
||||
*
|
||||
* Copyright © 2002—2015 Sam Hocevar <sam@hocevar.net>
|
||||
*
|
||||
* This program is free software. It comes without any warranty, to
|
||||
* the extent permitted by applicable law. You can redistribute it
|
||||
* and/or modify it under the terms of the Do What The Fuck You Want
|
||||
* To Public License, Version 2, as published by Sam Hocevar. See
|
||||
* http://sam.zoy.org/wtfpl/COPYING for more details.
|
||||
* and/or modify it under the terms of the Do What the Fuck You Want
|
||||
* to Public License, Version 2, as published by the WTFPL Task Force.
|
||||
* See http://www.wtfpl.net/ for more details.
|
||||
*/
|
||||
|
||||
/*
|
||||
@@ -1190,11 +1190,11 @@ static char const *sig2name(int signum)
|
||||
static void version(void)
|
||||
{
|
||||
printf("zzuf %s\n", PACKAGE_VERSION);
|
||||
printf("Copyright (C) 2002-2010 Sam Hocevar <sam@hocevar.net>\n");
|
||||
printf("Copyright © 2002—2015 Sam Hocevar <sam@hocevar.net>\n");
|
||||
printf("This program is free software. It comes without any warranty, to the extent\n");
|
||||
printf("permitted by applicable law. You can redistribute it and/or modify it under\n");
|
||||
printf("the terms of the Do What The Fuck You Want To Public License, Version 2, as\n");
|
||||
printf("published by Sam Hocevar. See <http://sam.zoy.org/wtfpl/> for more details.\n");
|
||||
printf("the terms of the Do What the Fuck You Want to Public License, Version 2, as\n");
|
||||
printf("published by the WTFPL Task Force. See http://www.wtfpl.net/ for more details.\n");
|
||||
printf("\n");
|
||||
printf("Written by Sam Hocevar. Report bugs to <sam@hocevar.net>.\n");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user