0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2024-10-18 18:08:45 +00:00

Client: Use strncpy() instead strcpy()

This commit is contained in:
Pavel Tvrdík 2015-11-02 13:40:14 +01:00
parent 72948cc684
commit 6e69fcbdfc
3 changed files with 4 additions and 2 deletions

View File

@ -78,7 +78,7 @@ static int
input_complete(int arg UNUSED, int key UNUSED) input_complete(int arg UNUSED, int key UNUSED)
{ {
static int complete_flag; static int complete_flag;
char buf[256]; char buf[BIRDC_INPUT_COMPLETE_BUFFER_LEN];
if (rl_last_func != input_complete) if (rl_last_func != input_complete)
complete_flag = 0; complete_flag = 0;

View File

@ -10,6 +10,8 @@
extern int init, busy, interactive; extern int init, busy, interactive;
extern int term_lns, term_cls; extern int term_lns, term_cls;
#define BIRDC_INPUT_COMPLETE_BUFFER_LEN 256
/* birdc.c / birdcl.c */ /* birdc.c / birdcl.c */
void input_start_list(void); void input_start_list(void);

View File

@ -195,7 +195,7 @@ cmd_find_common_match(struct cmd_node *root, char *cmd, int len, int *pcount, ch
(*pcount)++; (*pcount)++;
if (best < 0) if (best < 0)
{ {
strcpy(buf, m->token + len); strncpy(buf, m->token + len, BIRDC_INPUT_COMPLETE_BUFFER_LEN);
best = m->len - len; best = m->len - len;
best_prio = m->prio; best_prio = m->prio;
} }