Mercurial > trustbridge
changeset 86:6f1a73575c99
Check input parameters
author | Andre Heinecke <aheinecke@intevation.de> |
---|---|
date | Thu, 20 Mar 2014 16:23:02 +0000 |
parents | e52df5870c4f |
children | be13e5e0a98f |
files | common/listutil.c |
diffstat | 1 files changed, 5 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/common/listutil.c Thu Mar 20 16:22:16 2014 +0000 +++ b/common/listutil.c Thu Mar 20 16:23:02 2014 +0000 @@ -40,12 +40,17 @@ #define READ_FILE_TOO_LARGE -2 #define READ_FILE_NO_MEMORY -3 #define READ_FILE_READ_FAILED -4 +#define READ_FILE_INVALID_CALL -5 static int read_file(const char *file_name, char **data, size_t *size, const size_t max_size) { FILE *f; long file_size; + if (!file_name || !data || !size || !max_size) { + return READ_FILE_INVALID_CALL; + } + f = fopen(file_name, "rb"); if (f == NULL) return READ_FILE_UNREADABLE;