From ff3935d0a6e4b639a070f3f980187d4774ca5da8 Mon Sep 17 00:00:00 2001 From: JP Rosevear Date: Mon, 15 Jan 2001 16:01:35 +0000 Subject: '2001-01-15 JP Rosevear * conduit/address-conduit.c (print_local): prevent segfaults and buffer overflows (print_remote): ditto 2001-01-15 JP Rosevear * conduits/todo/todo-conduit.c (print_local): prevent segfaults and buffer overflows. (print_remote): ditto * conduits/calendar/calendar-conduit.c: as above svn path=/trunk/; revision=7504 --- calendar/conduits/todo/todo-conduit.c | 38 ++++++++++++++++++++++------------- 1 file changed, 24 insertions(+), 14 deletions(-) (limited to 'calendar/conduits/todo') diff --git a/calendar/conduits/todo/todo-conduit.c b/calendar/conduits/todo/todo-conduit.c index d232b88173..abc3bd498d 100644 --- a/calendar/conduits/todo/todo-conduit.c +++ b/calendar/conduits/todo/todo-conduit.c @@ -77,13 +77,18 @@ print_local (EToDoLocalRecord *local) } if (local->todo && local->todo->description) { - sprintf (buff, "[%d %ld %d %d '%s' '%s']", - local->todo->indefinite, - mktime (& local->todo->due), - local->todo->priority, - local->todo->complete, - local->todo->description, - local->todo->note); + g_snprintf (buff, 4096, "[%d %ld %d %d '%s' '%s']", + local->todo->indefinite ? + local->todo->indefinite : "", + mktime (& local->todo->due), + local->todo->priority ? + local->todo->priority : "", + local->todo->complete ? + local->todo->complete : "", + local->todo->description ? + local->todo->description : "", + local->todo->note ? + local->todo->note : ""); return buff; } @@ -103,13 +108,18 @@ static char *print_remote (GnomePilotRecord *remote) memset (&todo, 0, sizeof (struct ToDo)); unpack_ToDo (&todo, remote->record, remote->length); - sprintf (buff, "[%d %ld %d %d '%s' '%s']", - todo.indefinite, - mktime (& todo.due), - todo.priority, - todo.complete, - todo.description, - todo.note); + g_snprintf (buff, "[%d %ld %d %d '%s' '%s']", + todo.indefinite ? + todo.indefinite : "", + mktime (&todo.due), + todo.priority ? + todo.priority : "", + todo.complete ? + todo.complete : "", + todo.description ? + todo.description : "", + todo.note ? + todo.note : ""); return buff; } -- cgit