Skip to content

Commit

Permalink
Check bounds before dereference
Browse files Browse the repository at this point in the history
Signed-off-by: Michal Čihař <michal@cihar.com>
  • Loading branch information
nijel committed Apr 14, 2015
1 parent a27d6a3 commit 6157255
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions gammu/src/gammu.c
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ static void CheckIncomingEvents(StateMachineObject *sm) {
do {
sm->IncomingCallQueue[i] = sm->IncomingCallQueue[i + 1];
i++;
} while (sm->IncomingCallQueue[i] != NULL && i < MAX_EVENTS);
} while (i < MAX_EVENTS && sm->IncomingCallQueue[i] != NULL);

if (arglist == NULL) {
pyg_error("Discarding incoming call event due to error while building params!\n");
Expand Down Expand Up @@ -362,7 +362,7 @@ static void CheckIncomingEvents(StateMachineObject *sm) {
do {
sm->IncomingSMSQueue[i] = sm->IncomingSMSQueue[i + 1];
i++;
} while (sm->IncomingSMSQueue[i] != NULL && i < MAX_EVENTS);
} while (i < MAX_EVENTS && sm->IncomingSMSQueue[i] != NULL);

arglist = Py_BuildValue("(OsO)", sm, "SMS", event);
Py_DECREF(event);
Expand Down Expand Up @@ -395,7 +395,7 @@ static void CheckIncomingEvents(StateMachineObject *sm) {
do {
sm->IncomingCBQueue[i] = sm->IncomingCBQueue[i + 1];
i++;
} while (sm->IncomingCBQueue[i] != NULL && i < MAX_EVENTS);
} while (i < MAX_EVENTS && sm->IncomingCBQueue[i] != NULL);

if (arglist == NULL) {
pyg_error("Discarding incoming CB event due to error while building params!\n");
Expand Down Expand Up @@ -426,7 +426,7 @@ static void CheckIncomingEvents(StateMachineObject *sm) {
do {
sm->IncomingUSSDQueue[i] = sm->IncomingUSSDQueue[i + 1];
i++;
} while (sm->IncomingUSSDQueue[i] != NULL && i < MAX_EVENTS);
} while (i < MAX_EVENTS && sm->IncomingUSSDQueue[i] != NULL);

if (arglist == NULL) {
pyg_error("Discarding incoming USSD event due to error while building params!\n");
Expand Down

0 comments on commit 6157255

Please sign in to comment.