commit 8205159

default  ·  2023-04-16 18:12:44 +0000 UTC
parent 80cd4ea
Replaced strcpy() with strncpy().

To shut up some compiler whining.
2 files changed,  +3, -3
M data.c
M data.c
+2, -2
 1@@ -1017,7 +1017,7 @@ xs_list *timeline_top_level(snac *snac, xs_list *list)
 2     while (xs_list_iter(&p, &v)) {
 3         char line[256] = "";
 4 
 5-        strcpy(line, v);
 6+        strncpy(line, v, sizeof(line));
 7 
 8         for (;;) {
 9             char line2[256];
10@@ -1031,7 +1031,7 @@ xs_list *timeline_top_level(snac *snac, xs_list *list)
11                 break;
12 
13             /* it's here! try again with its own parent */
14-            strcpy(line, line2);
15+            strncpy(line, line2, sizeof(line));
16         }
17 
18         xs_set_add(&seen, line);
+1, -1
1@@ -1064,7 +1064,7 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path,
2                     char pid[64];
3 
4                     /* build the [grand]parent list, moving up */
5-                    strcpy(pid, id);
6+                    strncpy(pid, id, sizeof(pid));
7 
8                     while (object_parent(pid, pid, sizeof(pid))) {
9                         xs *m2 = NULL;