aboutsummaryrefslogtreecommitdiff
path: root/fastjar
diff options
context:
space:
mode:
authorRanjit Mathew <rmathew@hotmail.com>2003-01-21 20:53:37 +0000
committerTom Tromey <tromey@gcc.gnu.org>2003-01-21 20:53:37 +0000
commitc29ba56af123eb5f007b2e51eb4243f478262d91 (patch)
tree40d2ac5db5839552ad17840e417fe7e673b71d37 /fastjar
parenteb497e64c457bba88568621666ad4438b9755787 (diff)
jartool.c (list_jar): Terminate the 'ascii_date' buffer with a '\0' to guard against the case where...
2003-01-21 Ranjit Mathew <rmathew@hotmail.com> * jartool.c (list_jar): Terminate the 'ascii_date' buffer with a '\0' to guard against the case where the formatted time string is more than the size allowed by the buffer. From-SVN: r61572
Diffstat (limited to 'fastjar')
-rw-r--r--fastjar/ChangeLog40
-rw-r--r--fastjar/jartool.c4
2 files changed, 43 insertions, 1 deletions
diff --git a/fastjar/ChangeLog b/fastjar/ChangeLog
index b9d1bcb195a..8530a10667d 100644
--- a/fastjar/ChangeLog
+++ b/fastjar/ChangeLog
@@ -1,3 +1,43 @@
+2003-01-21 Ranjit Mathew <rmathew@hotmail.com>
+
+ * jartool.c (list_jar): Terminate the 'ascii_date' buffer
+ with a '\0' to guard against the case where the formatted
+ time string is more than the size allowed by the buffer.
+
+Patch:
+-------------------------- 8< --------------------------
+--- ChangeLog Mon Jan 20 23:27:56 2003
++++ ChangeLog Mon Jan 20 23:31:42 2003
+@@ -1572,5 +1572,5 @@
+ time_t tdate;
+ struct tm *s_tm;
+- char ascii_date[30];
++ char ascii_date[31];
+ zipentry ze;
+
+@@ -1663,4 +1663,5 @@
+ s_tm = localtime(&tdate);
+ strftime(ascii_date, 30, "%a %b %d %H:%M:%S %Z %Y", s_tm);
++ ascii_date[30] = '\0';
+ }
+
+@@ -1782,4 +1783,5 @@
+ s_tm = localtime(&tdate);
+ strftime(ascii_date, 30, "%a %b %d %H:%M:%S %Z %Y", s_tm);
++ ascii_date[30] = '\0';
+ }
+
+-------------------------- 8< --------------------------
+
+Sincerely Yours,
+Ranjit.
+
+--
+Ranjit Mathew Email: rmathew AT hotmail DOT com
+Bangalore,
+INDIA. Web: http://ranjitmathew.tripod.com/
+
+
2002-12-30 DJ Delorie <dj@redhat.com>
* Makefile.am (jar.1, grepjar.1): Protect against
diff --git a/fastjar/jartool.c b/fastjar/jartool.c
index 7cc06aaad5b..359b785c520 100644
--- a/fastjar/jartool.c
+++ b/fastjar/jartool.c
@@ -1571,7 +1571,7 @@ int list_jar(int fd, char **files, int file_num){
int i, j;
time_t tdate;
struct tm *s_tm;
- char ascii_date[30];
+ char ascii_date[31];
zipentry ze;
#ifdef DEBUG
@@ -1662,6 +1662,7 @@ int list_jar(int fd, char **files, int file_num){
tdate = dos2unixtime(mdate);
s_tm = localtime(&tdate);
strftime(ascii_date, 30, "%a %b %d %H:%M:%S %Z %Y", s_tm);
+ ascii_date[30] = '\0';
}
if(filename_len < fnlen + 1){
@@ -1781,6 +1782,7 @@ int list_jar(int fd, char **files, int file_num){
tdate = dos2unixtime(mdate);
s_tm = localtime(&tdate);
strftime(ascii_date, 30, "%a %b %d %H:%M:%S %Z %Y", s_tm);
+ ascii_date[30] = '\0';
}
if(filename_len < fnlen + 1){