owfs: avoid npe in BUS_reset function

Monitor adapters (zeroconf, enet, usb and w1) don't have the reset
routine, causing null pointer dereference in BUS_reset function.

This patch has been submitted upstream:
https://sourceforge.net/p/owfs/bugs/67/

Signed-off-by: Marcin Jurkowski <marcin1j@gmail.com>
This commit is contained in:
Marcin Jurkowski 2015-06-29 21:01:04 +02:00
parent 2d537bc98f
commit 101fc3047c
1 changed files with 13 additions and 0 deletions

View File

@ -0,0 +1,13 @@
--- a/module/owlib/src/c/ow_reset.c
+++ b/module/owlib/src/c/ow_reset.c
@@ -21,6 +21,10 @@ RESET_TYPE BUS_reset(const struct parsed
struct connection_in * in = pn->selected_connection ;
STAT_ADD1_BUS(e_bus_resets, in);
+ if ( in->iroutines.reset == NO_RESET_ROUTINE ) {
+ return BUS_RESET_OK;
+ }
+
switch ( (in->iroutines.reset) (pn) ) {
case BUS_RESET_OK:
in->reconnect_state = reconnect_ok; // Flag as good!