diff --git a/src/common/fd.c b/src/common/fd.c index ce878e7..e93e4de 100644 --- a/src/common/fd.c +++ b/src/common/fd.c @@ -1,5 +1,6 @@ /* * zzuf - general purpose fuzzer + * * Copyright © 2006—2015 Sam Hocevar * * 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) diff --git a/src/common/fuzz.c b/src/common/fuzz.c index 1a06a48..a7e6305 100644 --- a/src/common/fuzz.c +++ b/src/common/fuzz.c @@ -1,13 +1,13 @@ /* * zzuf - general purpose fuzzer - * Copyright (c) 2006-2010 Sam Hocevar - * All Rights Reserved + * + * Copyright © 2006—2015 Sam Hocevar * * 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; } } diff --git a/src/libzzuf/lib-load.h b/src/libzzuf/lib-load.h index d98c417..4533218 100644 --- a/src/libzzuf/lib-load.h +++ b/src/libzzuf/lib-load.h @@ -1,13 +1,13 @@ /* * zzuf - general purpose fuzzer - * Copyright (c) 2006-2010 Sam Hocevar - * All Rights Reserved + * + * Copyright © 2006—2015 Sam Hocevar * * 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; diff --git a/src/libzzuf/lib-stream.c b/src/libzzuf/lib-stream.c index 90795e2..f23c9fc 100644 --- a/src/libzzuf/lib-stream.c +++ b/src/libzzuf/lib-stream.c @@ -1,13 +1,13 @@ /* * zzuf - general purpose fuzzer - * Copyright (c) 2006-2010 Sam Hocevar - * All Rights Reserved + * + * Copyright © 2006—2015 Sam Hocevar * * 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); \ diff --git a/src/libzzuf/sys.c b/src/libzzuf/sys.c index cc98ed9..3b6daf8 100644 --- a/src/libzzuf/sys.c +++ b/src/libzzuf/sys.c @@ -1,14 +1,14 @@ /* * zzuf - general purpose fuzzer - * Copyright (c) 2006-2012 Sam Hocevar - * 2012 Kévin Szkudłapski - * All Rights Reserved + * + * Copyright © 2006—2015 Sam Hocevar + * 2012 Kévin Szkudłapski * * 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; } } diff --git a/src/zzat.c b/src/zzat.c index dd7c560..c2530b9 100644 --- a/src/zzat.c +++ b/src/zzat.c @@ -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 ( )")) diff --git a/src/zzuf.c b/src/zzuf.c index cd12684..5a2a277 100644 --- a/src/zzuf.c +++ b/src/zzuf.c @@ -1,13 +1,13 @@ /* * zzuf - general purpose fuzzer - * Copyright (c) 2002-2010 Sam Hocevar - * All Rights Reserved + * + * Copyright © 2002—2015 Sam Hocevar * * 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 \n"); + printf("Copyright © 2002—2015 Sam Hocevar \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 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 .\n"); }