Browse code

corex: handle return code for ftell

(cherry picked from commit 5488a913c53d16449146625da278eec8779fdbc5)

Daniel-Constantin Mierla authored on 06/11/2016 21:40:42
Showing 1 changed files
... ...
@@ -341,6 +341,10 @@ static int w_file_read(sip_msg_t *msg, char *fn, char *vn)
341 341
 	}
342 342
 	fseek(f, 0, SEEK_END);
343 343
 	fsize = ftell(f);
344
+	if(fsize<0) {
345
+		LM_ERR("ftell failed on file: %.*s\n", fname.len, fname.s);
346
+		return -1;
347
+	}
344 348
 	fseek(f, 0, SEEK_SET);
345 349
 
346 350
 	content = pkg_malloc(fsize + 1);