diff options
Diffstat (limited to 'apps/tagtree.c')
-rw-r--r-- | apps/tagtree.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/apps/tagtree.c b/apps/tagtree.c index 691b2273de..5d61589eab 100644 --- a/apps/tagtree.c +++ b/apps/tagtree.c | |||
@@ -593,7 +593,7 @@ static bool parse_search(struct menu_entry *entry, const char *str) | |||
593 | menus[menu_count] = buffer_alloc(sizeof(struct menu_root)); | 593 | menus[menu_count] = buffer_alloc(sizeof(struct menu_root)); |
594 | new_menu = menus[menu_count]; | 594 | new_menu = menus[menu_count]; |
595 | memset(new_menu, 0, sizeof(struct menu_root)); | 595 | memset(new_menu, 0, sizeof(struct menu_root)); |
596 | strncpy(new_menu->id, buf, MAX_MENU_ID_SIZE-1); | 596 | strlcpy(new_menu->id, buf, MAX_MENU_ID_SIZE); |
597 | entry->link = menu_count; | 597 | entry->link = menu_count; |
598 | ++menu_count; | 598 | ++menu_count; |
599 | 599 | ||
@@ -839,7 +839,7 @@ static int parse_line(int n, const char *buf, void *parameters) | |||
839 | menu = menus[menu_count]; | 839 | menu = menus[menu_count]; |
840 | ++menu_count; | 840 | ++menu_count; |
841 | memset(menu, 0, sizeof(struct menu_root)); | 841 | memset(menu, 0, sizeof(struct menu_root)); |
842 | strncpy(menu->id, data, MAX_MENU_ID_SIZE-1); | 842 | strlcpy(menu->id, data, MAX_MENU_ID_SIZE); |
843 | } | 843 | } |
844 | 844 | ||
845 | if (get_token_str(menu->title, sizeof(menu->title)) < 0) | 845 | if (get_token_str(menu->title, sizeof(menu->title)) < 0) |
@@ -1442,8 +1442,8 @@ int tagtree_enter(struct tree_context* c) | |||
1442 | csi = menu->items[seek]->si; | 1442 | csi = menu->items[seek]->si; |
1443 | c->currextra = 0; | 1443 | c->currextra = 0; |
1444 | 1444 | ||
1445 | strncpy(current_title[c->currextra], dptr->name, | 1445 | strlcpy(current_title[c->currextra], dptr->name, |
1446 | sizeof(current_title[0]) - 1); | 1446 | sizeof(current_title[0])); |
1447 | 1447 | ||
1448 | /* Read input as necessary. */ | 1448 | /* Read input as necessary. */ |
1449 | for (i = 0; i < csi->tagorder_count; i++) | 1449 | for (i = 0; i < csi->tagorder_count; i++) |
@@ -1464,7 +1464,7 @@ int tagtree_enter(struct tree_context* c) | |||
1464 | if (source == source_current_path && id3) | 1464 | if (source == source_current_path && id3) |
1465 | { | 1465 | { |
1466 | char *e; | 1466 | char *e; |
1467 | strncpy(searchstring, id3->path, SEARCHSTR_SIZE); | 1467 | strlcpy(searchstring, id3->path, SEARCHSTR_SIZE); |
1468 | e = strrchr(searchstring, '/'); | 1468 | e = strrchr(searchstring, '/'); |
1469 | if (e) | 1469 | if (e) |
1470 | *e = '\0'; | 1470 | *e = '\0'; |
@@ -1477,8 +1477,7 @@ int tagtree_enter(struct tree_context* c) | |||
1477 | char **src = (char**)((char*)id3 + offset); | 1477 | char **src = (char**)((char*)id3 + offset); |
1478 | if (*src) | 1478 | if (*src) |
1479 | { | 1479 | { |
1480 | strncpy(searchstring, *src, SEARCHSTR_SIZE); | 1480 | strlcpy(searchstring, *src, SEARCHSTR_SIZE); |
1481 | searchstring[SEARCHSTR_SIZE-1] = '\0'; | ||
1482 | } | 1481 | } |
1483 | } | 1482 | } |
1484 | else | 1483 | else |
@@ -1528,8 +1527,8 @@ int tagtree_enter(struct tree_context* c) | |||
1528 | c->dirlevel--; | 1527 | c->dirlevel--; |
1529 | 1528 | ||
1530 | /* Update the statusbar title */ | 1529 | /* Update the statusbar title */ |
1531 | strncpy(current_title[c->currextra], dptr->name, | 1530 | strlcpy(current_title[c->currextra], dptr->name, |
1532 | sizeof(current_title[0]) - 1); | 1531 | sizeof(current_title[0])); |
1533 | break; | 1532 | break; |
1534 | 1533 | ||
1535 | default: | 1534 | default: |