From 43adc7224042c4fb5ea9a719c0d5799a97ab451a Mon Sep 17 00:00:00 2001 From: Simon Busch Date: Sun, 9 Sep 2012 13:29:34 +0200 Subject: call: fix retrieval of the number of a call --- samsung-ipc/call.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/samsung-ipc/call.c b/samsung-ipc/call.c index 5173dfc..77c3325 100644 --- a/samsung-ipc/call.c +++ b/samsung-ipc/call.c @@ -96,15 +96,16 @@ char* ipc_call_list_response_get_entry_number(struct ipc_message_info *response, if (num > count) return NULL; - for (n = 0; n < num; n++) + for (n = 0; n < num + 1; n++) { + if (entry != NULL) + pos += entry->number_len; + entry = (struct ipc_call_list_entry*) (response->data + pos); - pos += (unsigned int) (sizeof(struct ipc_call_list_entry) + entry->number_len); + pos += (unsigned int) sizeof(struct ipc_call_list_entry); } - if (entry == NULL || - (unsigned char*) (response->data + pos) == NULL || - (unsigned char*) (response->data + pos + entry->number_len) == NULL) + if (entry == NULL || (unsigned char*) (response->data + pos) == NULL) return NULL; number = (char*) malloc(sizeof(char) * entry->number_len); -- cgit v1.1