]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Client: Use strncpy() instead strcpy()
authorPavel Tvrdík <pawel.tvrdik@gmail.com>
Mon, 2 Nov 2015 12:40:14 +0000 (13:40 +0100)
committerPavel Tvrdík <pawel.tvrdik@gmail.com>
Mon, 2 Nov 2015 12:41:15 +0000 (13:41 +0100)
client/birdc.c
client/client.h
client/commands.c

index ccf758be2a6c29e00373fed9e2362542cd27f952..3c6c31f127994d69c57f242b643a495f35d8276a 100644 (file)
@@ -78,7 +78,7 @@ static int
 input_complete(int arg UNUSED, int key UNUSED)
 {
   static int complete_flag;
-  char buf[256];
+  char buf[BIRDC_INPUT_COMPLETE_BUFFER_LEN];
 
   if (rl_last_func != input_complete)
     complete_flag = 0;
index b194a772634cc99cd8f9fbc9cb38dffd136a9fcc..bd1fd8178475516a0baf2416331533eb28a3eeaa 100644 (file)
@@ -10,6 +10,8 @@
 extern int init, busy, interactive;
 extern int term_lns, term_cls;
 
+#define BIRDC_INPUT_COMPLETE_BUFFER_LEN        256
+
 /* birdc.c / birdcl.c */
 
 void input_start_list(void);
index 50fcba409ff8eaf3cecca35fd8a2b35059033163..41baae1516e23d28eec7ba2f7882599e7d2ee247 100644 (file)
@@ -195,7 +195,7 @@ cmd_find_common_match(struct cmd_node *root, char *cmd, int len, int *pcount, ch
       (*pcount)++;
       if (best < 0)
        {
-         strcpy(buf, m->token + len);
+         strncpy(buf, m->token + len, BIRDC_INPUT_COMPLETE_BUFFER_LEN);
          best = m->len - len;
          best_prio = m->prio;
        }