Commit 4ff863b1 authored by Roel Kluin's avatar Roel Kluin Committed by Greg Kroah-Hartman
Browse files

Staging: comedi: s626: Possible read buffer overflow fix



If `cmd->chanlist_len' is 0, then we write ppl[-1].

Signed-off-by: default avatarRoel Kluin <roel.kluin@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 88a28c82
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -1707,6 +1707,7 @@ static int s626_ai_load_polllist(uint8_t * ppl, struct comedi_cmd *cmd)
		else
			ppl[n] = (CR_CHAN((cmd->chanlist)[n])) | (RANGE_10V);
	}
	if (n != 0)
		ppl[n - 1] |= EOPL;

	return n;