2005-05-20 Sergei Organov <osv@topconrd.ru>

PR 750/networking
	* libnetworking/pppd/sys-rtems.c: Avoid NULL dereference in
	wait_input().
This commit is contained in:
Joel Sherrill
2005-05-20 19:33:23 +00:00
parent 862cbe3aee
commit 9f114a806a
3 changed files with 30 additions and 8 deletions

View File

@@ -1,3 +1,9 @@
2005-05-20 Sergei Organov <osv@topconrd.ru>
PR 750/networking
* libnetworking/pppd/sys-rtems.c: Avoid NULL dereference in
wait_input().
2005-05-17 Jennifer Averett <jennifer.averett@oarcorp.com> 2005-05-17 Jennifer Averett <jennifer.averett@oarcorp.com>
* libchip/network/if_fxp.c, libchip/serial/ns16550.c: Modified to use * libchip/network/if_fxp.c, libchip/serial/ns16550.c: Modified to use

View File

@@ -513,14 +513,22 @@ void
wait_input(timo) wait_input(timo)
struct timeval *timo; struct timeval *timo;
{ {
rtems_interval ticks;
rtems_event_set events; rtems_event_set events;
rtems_interval ticks = 0;
rtems_option wait = RTEMS_WAIT;
ticks = ((timo->tv_sec*1000000)+timo->tv_usec)/rtems_bsdnet_microseconds_per_tick; if(timo) {
if ( ticks > 0 ) { if(timo->tv_sec == 0 && timo->tv_usec == 0)
rtems_event_receive(RTEMS_EVENT_31, (RTEMS_EVENT_ANY|RTEMS_WAIT), ticks, &events); wait = RTEMS_NO_WAIT;
else {
ticks = (timo->tv_sec * 1000000 + timo->tv_usec) /
rtems_bsdnet_microseconds_per_tick;
if(ticks <= 0)
ticks = 1;
} }
} }
rtems_event_receive(RTEMS_EVENT_31, RTEMS_EVENT_ANY | wait, ticks, &events);
}
/* /*
* read_packet - get a PPP packet from the serial device. * read_packet - get a PPP packet from the serial device.

View File

@@ -513,14 +513,22 @@ void
wait_input(timo) wait_input(timo)
struct timeval *timo; struct timeval *timo;
{ {
rtems_interval ticks;
rtems_event_set events; rtems_event_set events;
rtems_interval ticks = 0;
rtems_option wait = RTEMS_WAIT;
ticks = ((timo->tv_sec*1000000)+timo->tv_usec)/rtems_bsdnet_microseconds_per_tick; if(timo) {
if ( ticks > 0 ) { if(timo->tv_sec == 0 && timo->tv_usec == 0)
rtems_event_receive(RTEMS_EVENT_31, (RTEMS_EVENT_ANY|RTEMS_WAIT), ticks, &events); wait = RTEMS_NO_WAIT;
else {
ticks = (timo->tv_sec * 1000000 + timo->tv_usec) /
rtems_bsdnet_microseconds_per_tick;
if(ticks <= 0)
ticks = 1;
} }
} }
rtems_event_receive(RTEMS_EVENT_31, RTEMS_EVENT_ANY | wait, ticks, &events);
}
/* /*
* read_packet - get a PPP packet from the serial device. * read_packet - get a PPP packet from the serial device.