[balsa/gtk3] Use *scanf field limits to satisfy cppcheck
- From: Peter Bloomfield <PeterB src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [balsa/gtk3] Use *scanf field limits to satisfy cppcheck
- Date: Sun, 22 Jul 2012 19:42:26 +0000 (UTC)
commit 01343d0c4541600f71e9f36bef7c1386147e59a0
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date: Sun Jul 22 14:57:07 2012 -0400
Use *scanf field limits to satisfy cppcheck
* libbalsa/address-book-extern.c (parse_externq_file): use
*scanf field limits to satisfy cppcheck.
ChangeLog | 5 +++++
libbalsa/address-book-extern.c | 6 +++++-
2 files changed, 10 insertions(+), 1 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 0b59b56..2f05f25 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2012-07-22 Peter Bloomfield
+
+ * libbalsa/address-book-extern.c (parse_externq_file): use
+ *scanf field limits to satisfy cppcheck.
+
2012-07-15 Peter Bloomfield
* src/mailbox-node.c (balsa_mailbox_local_append): simplify.
diff --git a/libbalsa/address-book-extern.c b/libbalsa/address-book-extern.c
index bd384d7..8877ed2 100644
--- a/libbalsa/address-book-extern.c
+++ b/libbalsa/address-book-extern.c
@@ -55,6 +55,7 @@
/* FIXME: Arbitrary constant */
#define LINE_LEN 256
+#define LINE_LEN_STR "256"
static LibBalsaAddressBookClass *parent_class = NULL;
@@ -270,7 +271,10 @@ parse_externq_file(LibBalsaAddressBookExtern *addr_externq,
} /* FIXME check error */
while (fgets(string, sizeof(string), gc)) {
- int i=sscanf(string, "%[^\t]\t%[^\t]%[^\n]", email, name, tmp);
+ int i=sscanf(string, "%" LINE_LEN_STR "[^\t]\t"
+ "%" LINE_LEN_STR "[^\t]"
+ "%" LINE_LEN_STR "[^\n]",
+ email, name, tmp);
#ifdef DEBUG
printf("%s =>%i\n", string, i);
#endif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]