commit 331410a65272e991b247e02d51634b67b458f07a Author: Nathael Pajani Date: Fri Mar 29 16:40:46 2013 +0100 Prevent possible division by 0 diff --git a/src/ftdi.c b/src/ftdi.c index 6d4a64b..2696c21 100644 --- a/src/ftdi.c +++ b/src/ftdi.c @@ -1135,6 +1135,11 @@ static int ftdi_to_clkbits(int baudrate, unsigned int clk, int clk_div, unsigned *encoded_divisor = 2; best_baud = clk/(2*clk_div); } + else if (baudrate == 0) + { + /* Please, do not try to divide by 0 ! */ + return -1; + } else { /* We divide by 16 to have 3 fractional bits and one bit for rounding */