diff options
Diffstat (limited to 'apps/plugins/keybox.c')
-rw-r--r-- | apps/plugins/keybox.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/apps/plugins/keybox.c b/apps/plugins/keybox.c index 08d5131eff..73fd138f09 100644 --- a/apps/plugins/keybox.c +++ b/apps/plugins/keybox.c | |||
@@ -330,11 +330,11 @@ static void hash_pw(union hash *out) | |||
330 | static void make_key(void) | 330 | static void make_key(void) |
331 | { | 331 | { |
332 | int i; | 332 | int i; |
333 | char buf[sizeof(master_pw) + sizeof(salt) + 1]; | 333 | char buf[sizeof(master_pw) + sizeof(salt) + 1] = {0}; |
334 | struct md5_s key_md5; | 334 | struct md5_s key_md5; |
335 | size_t len = rb->strlen(master_pw); | 335 | size_t len = rb->strlen(master_pw); |
336 | 336 | ||
337 | rb->strncpy(buf, master_pw, sizeof(buf)); | 337 | rb->strlcpy(buf, master_pw, sizeof(buf)); |
338 | 338 | ||
339 | rb->memcpy(&buf[len], &salt, sizeof(salt)); | 339 | rb->memcpy(&buf[len], &salt, sizeof(salt)); |
340 | 340 | ||
@@ -418,7 +418,7 @@ static int parse_buffer(void) | |||
418 | break; | 418 | break; |
419 | } | 419 | } |
420 | 420 | ||
421 | rb->strncpy(entry->title, start, FIELD_LEN); | 421 | rb->strlcpy(entry->title, start, FIELD_LEN); |
422 | start = end + 1; | 422 | start = end + 1; |
423 | 423 | ||
424 | end = rb->strchr(start, '\0'); /* find eol */ | 424 | end = rb->strchr(start, '\0'); /* find eol */ |
@@ -428,7 +428,7 @@ static int parse_buffer(void) | |||
428 | break; | 428 | break; |
429 | } | 429 | } |
430 | 430 | ||
431 | rb->strncpy(entry->name, start, FIELD_LEN); | 431 | rb->strlcpy(entry->name, start, FIELD_LEN); |
432 | start = end + 1; | 432 | start = end + 1; |
433 | 433 | ||
434 | end = rb->strchr(start, '\0'); /* find eol */ | 434 | end = rb->strchr(start, '\0'); /* find eol */ |
@@ -437,7 +437,7 @@ static int parse_buffer(void) | |||
437 | { | 437 | { |
438 | break; | 438 | break; |
439 | } | 439 | } |
440 | rb->strncpy(entry->password, start, FIELD_LEN); | 440 | rb->strlcpy(entry->password, start, FIELD_LEN); |
441 | start = end + 1; | 441 | start = end + 1; |
442 | entry->used = true; | 442 | entry->used = true; |
443 | if (i + 1 < MAX_ENTRIES - 1) | 443 | if (i + 1 < MAX_ENTRIES - 1) |
@@ -469,13 +469,13 @@ static void write_output(int fd) | |||
469 | for (i = 0; i < pw_list.num_entries; i++) | 469 | for (i = 0; i < pw_list.num_entries; i++) |
470 | { | 470 | { |
471 | len = rb->strlen(entry->title); | 471 | len = rb->strlen(entry->title); |
472 | rb->strncpy(p, entry->title, len+1); | 472 | rb->strlcpy(p, entry->title, len+1); |
473 | p += len+1; | 473 | p += len+1; |
474 | len = rb->strlen(entry->name); | 474 | len = rb->strlen(entry->name); |
475 | rb->strncpy(p, entry->name, len+1); | 475 | rb->strlcpy(p, entry->name, len+1); |
476 | p += len+1; | 476 | p += len+1; |
477 | len = rb->strlen(entry->password); | 477 | len = rb->strlen(entry->password); |
478 | rb->strncpy(p, entry->password, len+1); | 478 | rb->strlcpy(p, entry->password, len+1); |
479 | p += len+1; | 479 | p += len+1; |
480 | if (entry->next) | 480 | if (entry->next) |
481 | entry = entry->next; | 481 | entry = entry->next; |
@@ -517,7 +517,7 @@ static int enter_pw(char *pw_buf, size_t buflen, bool new_pw) | |||
517 | } | 517 | } |
518 | else | 518 | else |
519 | { | 519 | { |
520 | rb->strncpy(pw_buf, buf[0], buflen); | 520 | rb->strlcpy(pw_buf, buf[0], buflen); |
521 | hash_pw(&pwhash); | 521 | hash_pw(&pwhash); |
522 | return 0; | 522 | return 0; |
523 | } | 523 | } |