Created
April 28, 2014 14:57
-
-
Save weltling/11374615 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- ext/fileinfo/libmagic.orig/readcdf.c Tue Jan 7 04:13:42 2014 | |
+++ readcdf_new.c Mon Apr 28 16:55:57 2014 | |
@@ -97,6 +97,8 @@ | |
const char *s; | |
int len; | |
+ memset(&ts, 0, sizeof(ts)); | |
+ | |
for (i = 0; i < count; i++) { | |
cdf_print_property_name(buf, sizeof(buf), info[i].pi_id); | |
switch (info[i].pi_type) { | |
@@ -171,8 +173,11 @@ | |
return -1; | |
} else { | |
char *c, *ec; | |
- cdf_timestamp_to_timespec(&ts, tp); | |
- c = cdf_ctime(&ts.tv_sec, tbuf); | |
+ const time_t sec = ts.tv_sec; | |
+ if (cdf_timestamp_to_timespec(&ts, tp) == -1) { | |
+ return -1; | |
+ } | |
+ c = cdf_ctime(&sec, tbuf); | |
if (c != NULL && | |
(ec = strchr(c, '\n')) != NULL) | |
*ec = '\0'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment