aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@lanedo.com>2012-02-16 18:20:31 +0100
committerAleksander Morgado <aleksander@lanedo.com>2012-02-16 18:22:50 +0100
commit17e6f3ee8a9f5f366bc6bb21fac4d526d12b1f38 (patch)
tree121a221c223230dec3d8d5fbdf7c47a094e32357
parent415e8e1da85239a7dacbba328d513130c8f5d935 (diff)
core: fix loop limits in echo removal
-1 was actually correct, if data->len is 10, i goes from 0 to 8.
-rw-r--r--src/mm-at-serial-port.c2
-rw-r--r--src/tests/Makefile.am3
2 files changed, 3 insertions, 2 deletions
diff --git a/src/mm-at-serial-port.c b/src/mm-at-serial-port.c
index f49e9f0e..cd4bb133 100644
--- a/src/mm-at-serial-port.c
+++ b/src/mm-at-serial-port.c
@@ -66,7 +66,7 @@ mm_at_serial_port_remove_echo (GByteArray *response)
if (response->len <= 2)
return;
- for (i = 0; i < (response->len - 2); i++) {
+ for (i = 0; i < (response->len - 1); i++) {
/* If there is any content before the first
* <CR><LF>, assume it's echo or garbage, and skip it */
if (response->data[i] == '\r' && response->data[i + 1] == '\n') {
diff --git a/src/tests/Makefile.am b/src/tests/Makefile.am
index 0ed88c20..43b3eb13 100644
--- a/src/tests/Makefile.am
+++ b/src/tests/Makefile.am
@@ -47,7 +47,8 @@ test_at_serial_port_SOURCES = \
test_at_serial_port_CPPFLAGS = \
$(MM_CFLAGS) \
- -I$(top_srcdir)
+ -I$(top_srcdir) \
+ -I$(top_srcdir)/src
test_at_serial_port_LDADD = \
$(MM_LIBS) \