Bug 57016 - buffer overrun in bootp/dhcp code
buffer overrun in bootp/dhcp code
Product: eCos
Classification: Retired
Component: TCPIP (Show other bugs)
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Andrew Lunn
George Thomas
Depends On:
  Show dependency treegraph
Reported: 2001-12-03 05:14 EST by Andrew Lunn
Modified: 2007-04-18 12:38 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2001-12-03 16:14:28 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
Context diff to 1.5.2-final. (20.32 KB, patch)
2001-12-03 10:55 EST, Andrew Lunn
no flags Details | Diff

  None (edit)
Description Andrew Lunn 2001-12-03 05:14:04 EST
Description of Problem:

The reply from a DHCP server contains variable length options. Many of
these options are a list. In many places the code passes parameters to
get_bootp_option() to accept one entry from the list. If, for example, the
DHCP reply contains two routers, the first will be placed into the stack
variable gateway and the second will got splat over what ever is next on
the stack! 

get_bootp_option() should take an addition parameter, the size of the
buffer it should copy into. 

How Reproducible:

Theorectical bug only. Not tried it out yet. Configure your dhcp/bootp
server to reply with a list and see if it crashes.
Comment 1 Andrew Lunn 2001-12-03 10:53:55 EST

While fixing it i found we have a few other patches for the DHCP client in our
tree which never got contributed back. They are not my patches so i don't know
the details fully. 
It looks like the xid is being calculated at the wrong time. Each retry should
use the same xid. If it does not, and the server is slow, by the time its
replied, the client has a new xid and so ignores the reply. This realy shows up
with our server. Before replying it pings the IP address its about the give out
just to make sure its not being used. This can take a second by which time the
client has done few tries with different xids. The server replies with the old
xid and the client ignores it. The process only works once the client has backed
off so giving the server time to reply.

The second problem was that the xid was not changing in the message sent when it
legitimalty changed.
This patch fixed the buffer overrun as well! It overlaps the DHCP DNS patch so
you probably want to add that patch first.
Comment 2 Andrew Lunn 2001-12-03 10:55:19 EST
Created attachment 39427 [details]
Context diff to 1.5.2-final.
Comment 3 George Thomas 2001-12-03 16:14:23 EST
Commited to main CVS repository - trunk only

Note You need to log in before you can comment on or make changes to this bug.