aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook
diff options
context:
space:
mode:
Diffstat (limited to 'addressbook')
-rw-r--r--addressbook/ChangeLog6
-rw-r--r--addressbook/conduit/address-conduit.c22
2 files changed, 20 insertions, 8 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog
index 3bd02eeee8..e3c8ef7511 100644
--- a/addressbook/ChangeLog
+++ b/addressbook/ChangeLog
@@ -1,3 +1,9 @@
+2001-01-15 JP Rosevear <jpr@ximian.com>
+
+ * conduit/address-conduit.c (print_local): prevent segfaults and
+ buffer overflows
+ (print_remote): ditto
+
2001-01-14 JP Rosevear <jpr@ximian.com>
* conduit/Makefile.am: pass -module and -avoid-version to conduit
diff --git a/addressbook/conduit/address-conduit.c b/addressbook/conduit/address-conduit.c
index ee6aa56541..43ba2569e0 100644
--- a/addressbook/conduit/address-conduit.c
+++ b/addressbook/conduit/address-conduit.c
@@ -96,10 +96,13 @@ print_local (EAddrLocalRecord *local)
}
if (local->addr) {
- sprintf (buff, "['%s' '%s' '%s']",
- local->addr->entry[entryLastname],
- local->addr->entry[entryFirstname],
- local->addr->entry[entryCompany]);
+ g_snprintf (buff, 4096, "['%s' '%s' '%s']",
+ local->addr->entry[entryLastname] ?
+ local->addr->entry[entryLastname] : "",
+ local->addr->entry[entryFirstname] ?
+ local->addr->entry[entryFirstname] : "",
+ local->addr->entry[entryCompany] ?
+ local->addr->entry[entryCompany] : "");
return buff;
}
@@ -119,10 +122,13 @@ static char *print_remote (GnomePilotRecord *remote)
memset (&addr, 0, sizeof (struct Address));
unpack_Address (&addr, remote->record, remote->length);
- sprintf (buff, "['%s' '%s' '%s']",
- addr.entry[entryLastname],
- addr.entry[entryFirstname],
- addr.entry[entryCompany]);
+ g_snprintf (buff, 4096, "['%s' '%s' '%s']",
+ addr.entry[entryLastname] ?
+ addr.entry[entryLastname] : "",
+ addr.entry[entryFirstname] ?
+ addr.entry[entryFirstname] : "",
+ addr.entry[entryCompany] ?
+ addr.entry[entryCompany] : "");
return buff;
}