Bug 138228

Summary: CAN-2004-1010 buffer overflow when creating archive containing very long filenames.
Product: Red Hat Enterprise Linux 3 Reporter: Josh Bressers <bressers>
Component: zipAssignee: Lon Hohberger <lhh>
Status: CLOSED ERRATA QA Contact:
Severity: low Docs Contact:
Priority: medium    
Version: 3.0CC: lhh
Target Milestone: ---Keywords: Security
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard: impact=low,public=20041103
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2004-12-16 20:49:33 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Patch which fixes this issue.
none
New patch to fix the buffer overflow. none

Description Josh Bressers 2004-11-05 21:05:08 UTC
A buffer overflow has been found in zip which will lead to a buffer
overflow when a user try to create a zip archive which contains very
long filenames.

See:
http://lists.netsys.com/pipermail/full-disclosure/2004-November/028379.html

This issue is going to affect RHEL2.1 as well.

Comment 1 Josh Bressers 2004-11-05 21:19:27 UTC
Created attachment 106240 [details]
Patch which fixes this issue.

Comment 2 Josh Bressers 2004-11-06 13:35:16 UTC
Created attachment 106249 [details]
New patch to fix the buffer overflow.

This patch fixes a leak, I was not freeing a malloc'd variable in the previous
one.

Comment 3 Lon Hohberger 2004-11-08 15:28:37 UTC
Patch from mailing list:

diff -Nur zip-2.30/unix/unix.c zip-2.30.new/unix/unix.c
--- zip-2.30/unix/unix.c	2004-11-05 14:22:42.957410560 +0100
+++ zip-2.30.new/unix/unix.c	2004-11-05 14:22:03.620390696 +0100
@@ -322,6 +322,9 @@
   char name[FNMAX];
   int len = strlen(f);

+  if (len >= FNMAX)
+    error("file name too long");
+
   if (f == label) {
     if (a != NULL)
       *a = label_mode;

Comment 5 Josh Bressers 2004-11-08 22:15:46 UTC
*** Bug 138392 has been marked as a duplicate of this bug. ***

Comment 7 Josh Bressers 2004-12-16 20:49:33 UTC
An errata has been issued which should help the problem 
described in this bug report. This report is therefore being 
closed with a resolution of ERRATA. For more information
on the solution and/or where to find the updated files, 
please follow the link below. You may reopen this bug report 
if the solution does not work for you.

http://rhn.redhat.com/errata/RHSA-2004-634.html