Don't try to send garbage after each init script entry
authornorly <ny-git@enpas.org>
Sun, 17 Feb 2019 23:45:42 +0000 (00:45 +0100)
committernorly <ny-git@enpas.org>
Sun, 17 Feb 2019 23:48:43 +0000 (00:48 +0100)
Previously, we'd try to send the local txbuf even though it had not been
written to. Thus strlen() would overrun the buffer, which recent Linux
versions catch in a BUG_ON().

module/elmcan.c

index 14cfe271c0566eddc58c76d850d5e1e0d71a0025..3724d97fdc7b763a1229a955e29e8704cbbe62eb 100644 (file)
@@ -579,6 +579,8 @@ static void elm327_handle_prompt(struct elmcan *elm)
                         */
                        elm->state = ELM_NOTINIT;
                        elm327_kick_into_cmd_mode(elm);
+
+                       return;
                } else if (test_and_clear_bit(ELM_TODO_SILENT_MONITOR, &elm->cmds_todo)) {
                        snprintf(txbuf, sizeof(txbuf), "ATCSM%i\r", !(!(elm->can.ctrlmode & CAN_CTRLMODE_LISTENONLY)));
                } else if (test_and_clear_bit(ELM_TODO_RESPONSES, &elm->cmds_todo)) {