mirror of
https://github.com/logicog/RTLPlayground.git
synced 2026-10-29 17:54:14 +08:00
syslog: do not read the connection before there is one
udp_callbacks() offers every UDP connection event to syslog_callback(), which decides whether the event is its own by comparing the local port against state.syslog_conn->lport. The pointer is null until syslog is started: syslog_init() clears it at boot and syslog_stop() clears it again, so with syslog off, which is the default, every poll dereferences null and reads whatever lives at the bottom of xdata. Should that word ever match the port being offered, the send path runs on another application's connection, overwrites uip_appdata and drops the log line it was holding. Test the pointer first.
This commit is contained in:
1 parent
0cc09e4015
commit
9e3863cc4e
1 file changed
+1
-1
@@ -60,7 +60,7 @@ void syslog_stop(void) __banked
|
||||
void syslog_callback(uint16_t lport) __banked
|
||||
{
|
||||
uint16_t syslog_hdr;
|
||||
if (lport != state.syslog_conn->lport)
|
||||
if (!state.syslog_conn || lport != state.syslog_conn->lport)
|
||||
return;
|
||||
|
||||
if ((state.readptr != state.writeptr) && state.line_available)
|
||||
|
||||
Reference in new issue
Block a user