diff options
author | Frederic Culot <calcurse@culot.org> | 2006-12-15 15:25:09 +0000 |
---|---|---|
committer | Frederic Culot <calcurse@culot.org> | 2006-12-15 15:25:09 +0000 |
commit | 9d7650295c8e2da73768f7a5580fa041a833f416 (patch) | |
tree | 2d3da9daa6de7b9b42025794bb05ae8d6dbdb707 /src | |
parent | 2e1995320d959c22509f1d5201bb3363f1e966b8 (diff) | |
download | calcurse-9d7650295c8e2da73768f7a5580fa041a833f416.tar.gz calcurse-9d7650295c8e2da73768f7a5580fa041a833f416.zip |
strcpy replaced by strncpy
Diffstat (limited to 'src')
-rwxr-xr-x | src/apoint.c | 8 | ||||
-rwxr-xr-x | src/event.c | 4 | ||||
-rwxr-xr-x | src/recur.c | 8 | ||||
-rwxr-xr-x | src/todo.c | 4 |
4 files changed, 12 insertions, 12 deletions
diff --git a/src/apoint.c b/src/apoint.c index d0361e5..6a7a859 100755 --- a/src/apoint.c +++ b/src/apoint.c @@ -1,4 +1,4 @@ -/* $calcurse: apoint.c,v 1.6 2006/10/28 13:09:59 culot Exp $ */ +/* $calcurse: apoint.c,v 1.7 2006/12/15 15:25:09 culot Exp $ */ /* * Calcurse - text-based organizer @@ -57,7 +57,7 @@ apoint_llist_node_t *apoint_new(char *mesg, long start, long dur) o = (apoint_llist_node_t *) malloc(sizeof(apoint_llist_node_t)); o->mesg = (char *) malloc(strlen(mesg) + 1); - strcpy(o->mesg, mesg); + strncpy(o->mesg, mesg, strlen(mesg) + 1); o->start = start; o->dur = dur; @@ -91,7 +91,7 @@ void apoint_sec2str(apoint_llist_node_t *o, time_t t; if (o->start < day && type == APPT) { - strcpy(start, "..:.."); + strncpy(start, "..:..", 6); } else { t = o->start; lt = localtime(&t); @@ -99,7 +99,7 @@ void apoint_sec2str(apoint_llist_node_t *o, lt->tm_min); } if (o->start + o->dur > day + 24 * 3600 && type == APPT) { - strcpy(end, "..:.."); + strncpy(end, "..:..", 6); } else { t = o->start + o->dur; lt = localtime(&t); diff --git a/src/event.c b/src/event.c index 4cf3953..aeeee8d 100755 --- a/src/event.c +++ b/src/event.c @@ -1,4 +1,4 @@ -/* $calcurse: event.c,v 1.1 2006/07/31 21:00:03 culot Exp $ */ +/* $calcurse: event.c,v 1.2 2006/12/15 15:25:28 culot Exp $ */ /* * Calcurse - text-based organizer @@ -42,7 +42,7 @@ struct event_s *event_new(char *mesg, long day, int id) struct event_s *o, **i; o = (struct event_s *) malloc(sizeof(struct event_s)); o->mesg = (char *) malloc(strlen(mesg) + 1); - strcpy(o->mesg, mesg); + strncpy(o->mesg, mesg, strlen(mesg) + 1); o->day = day; o->id = id; i = &eventlist; diff --git a/src/recur.c b/src/recur.c index 6f4b860..ac66521 100755 --- a/src/recur.c +++ b/src/recur.c @@ -1,4 +1,4 @@ -/* $calcurse: recur.c,v 1.17 2006/12/08 08:42:43 culot Exp $ */ +/* $calcurse: recur.c,v 1.18 2006/12/15 15:26:05 culot Exp $ */ /* * Calcurse - text-based organizer @@ -64,7 +64,7 @@ recur_apoint_llist_node_t *recur_apoint_new(char *mesg, long start, long dur, o->rpt = (struct rpt_s *) malloc(sizeof(struct rpt_s)); o->mesg = (char *) malloc(strlen(mesg) + 1); o->exc = (struct days_s *) malloc(sizeof(struct days_s)); - strcpy(o->mesg, mesg); + strncpy(o->mesg, mesg, strlen(mesg) + 1); o->start = start; o->dur = dur; o->rpt->type = type; @@ -96,7 +96,7 @@ struct recur_event_s *recur_event_new(char *mesg, long day, int id, o->rpt = (struct rpt_s *) malloc(sizeof(struct rpt_s)); o->mesg = (char *) malloc(strlen(mesg) + 1); o->exc = (struct days_s *) malloc(sizeof(struct days_s)); - strcpy(o->mesg, mesg); + strncpy(o->mesg, mesg, strlen(mesg) + 1); o->day = day; o->id = id; o->rpt->type = type; @@ -568,7 +568,7 @@ void recur_repeat_item(int sel_year, int sel_month, int sel_day, status_mesg(mesg_wrong_freq, wrong_type_2); wgetch(swin); } - strcpy(user_input, ""); + user_input[0] = '\0'; } else { return; } @@ -1,4 +1,4 @@ -/* $calcurse: todo.c,v 1.7 2006/12/13 09:32:22 culot Exp $ */ +/* $calcurse: todo.c,v 1.8 2006/12/15 15:25:50 culot Exp $ */ /* * Calcurse - text-based organizer @@ -63,7 +63,7 @@ struct todo_s *todo_add(char *mesg, int id) struct todo_s *o, **i; o = (struct todo_s *) malloc(sizeof(struct todo_s)); o->mesg = (char *) malloc(strlen(mesg) + 1); - strcpy(o->mesg, mesg); + strncpy(o->mesg, mesg, strlen(mesg) + 1); o->id = id; i = &todolist; for (;;) { |