Index: configure.in =================================================================== RCS file: /cvsroot/gnokii/gnokii/configure.in,v retrieving revision 1.148 diff -u -p -r1.148 configure.in --- configure.in 19 May 2005 21:58:57 -0000 1.148 +++ configure.in 25 Jul 2005 19:34:59 -0000 @@ -277,7 +277,7 @@ AC_ARG_WITH(bluetooth, AC_MSG_WARN(Usage is: --with-bluetooth=DIR) else LIBS="$LIBS -L$withval/lib" - CFLAGS="$CFLAGS -I$withval/include" + CFLAGS="$CFLAGS -I$withval/net -I$withval/ " fi ] ) Index: common/phones/atgen.c =================================================================== RCS file: /cvsroot/gnokii/gnokii/common/phones/atgen.c,v retrieving revision 1.113 diff -u -p -r1.113 atgen.c --- common/phones/atgen.c 29 Jun 2005 20:55:18 -0000 1.113 +++ common/phones/atgen.c 25 Jul 2005 19:35:01 -0000 @@ -220,6 +221,7 @@ char *memorynames[] = { "TA", /* for compatibility only: TA=computer memory */ "CB", /* Currently selected memory */ }; +#define NR_MEMORIES (sizeof (memorynames) / sizeof ((memorynames)[0])) typedef struct { char *str; @@ -508,6 +510,8 @@ gn_error at_memory_type_set(gn_memory_ty gn_error ret = GN_ERR_NONE; if (mt != drvinst->memorytype) { + if (mt >= NR_MEMORIES) + return GN_ERR_INVALIDMEMORYTYPE; sprintf(req, "AT+CPBS=\"%s\"\r", memorynames[mt]); ret = sm_message_send(13, GN_OP_Init, req, state); if (ret) @@ -1362,7 +1372,7 @@ static gn_error ReplyGetSMSStatus(int me data->sms_status->folders_count = 0; data->sms_status->new_message_store = GN_MT_ME; - for (i = 0; i < sizeof(memorynames)/sizeof(char *); i++) { + for (i = 0; i < NR_MEMORIES; i++) { if (strcmp(store, memorynames[i]) == 0) { data->sms_status->new_message_store = i; break; Index: gnokii/gnokii.c =================================================================== RCS file: /cvsroot/gnokii/gnokii/gnokii/gnokii.c,v retrieving revision 1.423 diff -u -p -r1.423 gnokii.c --- gnokii/gnokii.c 18 Jul 2005 22:05:11 -0000 1.423 +++ gnokii/gnokii.c 25 Jul 2005 19:35:06 -0000 @@ -3328,6 +3328,8 @@ static int getphonebook(int argc, char * int i; case GN_ERR_NONE: num_entries--; + if (entry.empty != false) + break; switch (type) { case 1: gn_file_phonebook_raw_write(stdout, &entry, memory_type_string); @@ -3400,10 +3402,13 @@ static int getphonebook(int argc, char * fprintf(stderr, _("Empty memory location. Skipping.\n")); break; case GN_ERR_INVALIDLOCATION: - fprintf(stderr, _("Error reading from the location %d in memory %s\n"), count, memory_type_string); if (end_entry == INT_MAX) { /* Ensure that we quit the loop */ num_entries = 0; + } else { + /* Only print an error if we got a valid end + * index */ + fprintf(stderr, _("Error reading from the location %d in memory %s\n"), count, memory_type_string); } break; default: