diff options
author | Guy Harris <guy@alum.mit.edu> | 2017-12-13 18:44:17 -0800 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2017-12-14 02:44:51 +0000 |
commit | 7539469d79d80944ab2daa389aade7991302835d (patch) | |
tree | 8ed5c41e8ebe4ff47f89495bcfba067ea72487c6 /tools/oss-fuzzshark | |
parent | 6d30df0cdd83b051e02b1e90a905b7e51031cd22 (diff) |
Fix types.
ftell() returns a long; assign its value to a variable of that type.
size_t is unsigned, so checking that it's >= 0 always succeeds.
We can cast the variable's value to size_t once we've determined that it's
non-negative; do so, to avoid other warnings.
Change-Id: I0da6a220ce140ebf073df5f5bcd0c9526bf9c3c3
Reviewed-on: https://code.wireshark.org/review/24817
Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'tools/oss-fuzzshark')
-rw-r--r-- | tools/oss-fuzzshark/StandaloneFuzzTargetMain.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/tools/oss-fuzzshark/StandaloneFuzzTargetMain.c b/tools/oss-fuzzshark/StandaloneFuzzTargetMain.c index 49d039d539..13f08f9319 100644 --- a/tools/oss-fuzzshark/StandaloneFuzzTargetMain.c +++ b/tools/oss-fuzzshark/StandaloneFuzzTargetMain.c @@ -128,12 +128,12 @@ int main(int argc, char **argv) { FILE *f = ws_fopen(argv[i], "r"); assert(f); fseek(f, 0, SEEK_END); - size_t len = ftell(f); + long len = ftell(f); assert(len >= 0); fseek(f, 0, SEEK_SET); - unsigned char *buf = (unsigned char*)g_malloc(len); + unsigned char *buf = (unsigned char*)g_malloc((size_t)len); size_t n_read = fread(buf, 1, len, f); - assert(n_read == len); + assert(n_read == (size_t)len); fclose(f); LLVMFuzzerTestOneInput(buf, len); g_free(buf); |