libgcj/1436: potential buffer overruns

tromey@cygnus.com tromey@cygnus.com
Wed Dec 20 12:27:00 GMT 2000


>Number:         1436
>Category:       libgcj
>Synopsis:       potential buffer overruns
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    warrenl
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Dec 20 12:19:50 PST 2000
>Closed-Date:    Tue Nov 23 03:42:07 PST 1999
>Last-Modified:  Tue Nov 23 03:50:00 PST 1999
>Originator:     Tom Tromey
>Release:        current cvs
>Organization:
>Environment:

>Description:
Today I noticed that some C++ code in java.net has
potential buffer overruns.  For instance, from 
natPlainSocketImpl.cc:

  char msg[100];
  char* strerr = strerror (errno);
  sprintf (msg, "SocketImpl.getOption: %.*s", 80, strerr);

The constant text here is more than 20 characters long,
so the sprintf can potentially overrun the buffer.

>How-To-Repeat:

>Fix:
One fix would be to simply remove the constant text and
instead just use the result of strerror().  I don't think
we lose too much doing this (but I haven't looked to see
if this violates the spec or something).

Another approach would be to make the buffers bigger.
>Release-Note:

>Audit-Trail:

Formerly PR java.net/57

State-Changed-From-To: open->closed
State-Changed-By: bryce
State-Changed-When: Tue Nov 23 03:42:07 1999
State-Changed-Why:
    This patch was checked in:
    
    http://sourceware.cygnus.com/ml/java-patches/1999-q4/msg00061.html

From: bryce@sourceware.cygnus.com
To: java-gnats@sourceware.cygnus.com
Cc:  
Subject: java.net/57
Date: 23 Nov 1999 11:40:26 -0000

 	1999-11-23  Bryce McKinlay  <bryce@albatross.co.nz>
 	
 	* java/net/natPlainSocketImpl.cc: Fix potential buffer overruns in
 	Exception messages. PR java.net/57.
 	(bind): set SO_REUSEADDR before bind.
 	* java/net/natPlainDatagramSocketImpl.cc: Fix potential buffer
 	overruns. PR java.net/57.

From: bryce@albatross.co.nz
To: java-gnats@sourceware.cygnus.com, tromey@cygnus.com, warrenl@cygnus.com
Cc:  
Subject: Re: java.net/57
Date: 23 Nov 1999 11:42:07 -0000

 Synopsis: potential buffer overruns
 
 State-Changed-From-To: open->closed
 State-Changed-By: bryce
 State-Changed-When: Tue Nov 23 03:42:07 1999
 State-Changed-Why:
     This patch was checked in:
     
     http://sourceware.cygnus.com/ml/java-patches/1999-q4/msg00061.html
 
 http://sourceware.cygnus.com/cgi-bin/gnatsweb.pl?cmd=view&pr=57&database=java
>Unformatted:




More information about the Gcc-prs mailing list