uiemis-downloader.c: fix preceding limit check

next_segment():
The iterator limit check (i < size - 1) should precede
the indexing (buf[i]).

Reported by the program cppcheck.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Lubomir I. Ivanov 2013-12-11 15:26:49 +02:00 committed by Dirk Hohndel
parent fbcad20072
commit fe882ea58e

View file

@ -266,7 +266,7 @@ static char *next_segment(char *buf, int *offset, int size)
while (!done) { while (!done) {
if (i < size) { if (i < size) {
if (buf[i] == '\\' && i < size - 1 && if (i < size - 1 && buf[i] == '\\' &&
(buf[i+1] == '\\' || buf[i+1] == '{')) (buf[i+1] == '\\' || buf[i+1] == '{'))
memcpy(buf + i, buf + i + 1, size - i - 1); memcpy(buf + i, buf + i + 1, size - i - 1);
else if (buf[i] == '{') else if (buf[i] == '{')