diff options
Diffstat (limited to 'tests/tap/basic.c')
-rw-r--r-- | tests/tap/basic.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/tests/tap/basic.c b/tests/tap/basic.c index 92a749b..4f8be04 100644 --- a/tests/tap/basic.c +++ b/tests/tap/basic.c @@ -12,7 +12,8 @@ * This file is part of C TAP Harness. The current version plus supporting * documentation is at <http://www.eyrie.org/~eagle/software/c-tap-harness/>. * - * Copyright 2009, 2010, 2011, 2012, 2013, 2014 Russ Allbery <eagle@eyrie.org> + * Copyright 2009, 2010, 2011, 2012, 2013, 2014, 2015 + * Russ Allbery <eagle@eyrie.org> * Copyright 2001, 2002, 2004, 2005, 2006, 2007, 2008, 2011, 2012, 2013, 2014 * The Board of Trustees of the Leland Stanford Junior University * @@ -105,7 +106,7 @@ static struct cleanup_func *cleanup_funcs = NULL; /* * Registered diag files. Any output found in these files will be printed out * as if it were passed to diag() before any other output we do. This allows - * background processes to log to a file and have that output interleved with + * background processes to log to a file and have that output interleaved with * the test output. */ struct diag_file { @@ -192,7 +193,7 @@ check_diag_files(void) struct diag_file *file; fpos_t where; size_t length; - int incomplete; + int size, incomplete; /* * Walk through each file and read each line of output available. The @@ -216,7 +217,8 @@ check_diag_files(void) /* Continue until we get EOF or an incomplete line of data. */ incomplete = 0; while (!feof(file->file) && !incomplete) { - if (fgets(file->buffer, file->bufsize, file->file) == NULL) { + size = file->bufsize > INT_MAX ? INT_MAX : (int) file->bufsize; + if (fgets(file->buffer, size, file->file) == NULL) { if (ferror(file->file)) sysbail("cannot read from %s", file->name); continue; @@ -807,7 +809,7 @@ bstrndup(const char *s, size_t n) /* Don't assume that the source string is nul-terminated. */ for (p = s; (size_t) (p - s) < n && *p != '\0'; p++) ; - length = p - s; + length = (size_t) (p - s); copy = malloc(length + 1); if (p == NULL) sysbail("failed to strndup %lu bytes", (unsigned long) length); |