summaryrefslogtreecommitdiffstats
path: root/src/utils.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils.c')
-rw-r--r--src/utils.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/utils.c b/src/utils.c
index b03f13b..7b10a08 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -257,6 +257,10 @@ LIBIMOBILEDEVICE_GLUE_API int buffer_read_from_filename(const char *filename, ch
FILE *f;
uint64_t size;
+ if (!filename || !buffer || !length) {
+ return 0;
+ }
+
*length = 0;
f = fopen(filename, "rb");
@@ -275,7 +279,7 @@ LIBIMOBILEDEVICE_GLUE_API int buffer_read_from_filename(const char *filename, ch
*buffer = (char*)malloc(sizeof(char)*(size+1));
- if (!buffer) {
+ if (*buffer == NULL) {
return 0;
}