mirror of
				https://github.com/asterisk/asterisk.git
				synced 2025-10-31 10:47:18 +00:00 
			
		
		
		
	main/asterisk.c: ast_el_read_char
Make sure buf[res] is not accessed at res=-1 (buffer underrun). Address Sanitizer will complain about this quite loudly. ASTERISK-24801 #close Change-Id: Ifcd7f691310815a31756b76067c56fba299d3ae9
This commit is contained in:
		| @@ -2708,11 +2708,12 @@ static int ast_el_read_char(EditLine *editline, char *cp) | ||||
|  | ||||
| 			console_print(buf, 0); | ||||
|  | ||||
| 			if ((res < EL_BUF_SIZE - 1) && ((buf[res-1] == '\n') || (buf[res-2] == '\n'))) { | ||||
| 			if ((res < EL_BUF_SIZE - 1) && ((buf[res-1] == '\n') || (res >= 2 && buf[res-2] == '\n'))) { | ||||
| 				*cp = CC_REFRESH; | ||||
| 				return(1); | ||||
| 			} else | ||||
| 			} else { | ||||
| 				lastpos = 1; | ||||
| 			} | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user