[Asterisk-code-review] main/asterisk.c: ast el read char (asterisk[master])
Diederik de Groot
asteriskteam at digium.com
Mon Jan 18 03:59:43 CST 2016
Diederik de Groot has uploaded a new change for review.
https://gerrit.asterisk.org/2032
Change subject: main/asterisk.c: ast_el_read_char
......................................................................
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
Change-Id: Ifcd7f691310815a31756b76067c56fba299d3ae9
---
M main/asterisk.c
1 file changed, 3 insertions(+), 2 deletions(-)
git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/32/2032/1
diff --git a/main/asterisk.c b/main/asterisk.c
index a7842a6..36440f5 100644
--- a/main/asterisk.c
+++ b/main/asterisk.c
@@ -2708,11 +2708,12 @@
console_print(buf, 0);
- if ((res < EL_BUF_SIZE - 1) && ((buf[res-1] == '\n') || (buf[res-2] == '\n'))) {
+ if ((res < EL_BUF_SIZE - 1) && ((res >= 1 && buf[res-1] == '\n') || (res >= 2 && buf[res-2] == '\n'))) {
*cp = CC_REFRESH;
return(1);
- } else
+ } else {
lastpos = 1;
+ }
}
}
--
To view, visit https://gerrit.asterisk.org/2032
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ifcd7f691310815a31756b76067c56fba299d3ae9
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Owner: Diederik de Groot <dkgroot at talon.nl>
More information about the asterisk-code-review
mailing list