nixpkgs/pkgs/applications/networking/mailreaders/mutt/sidebar-delimnullwide.patch

39 lines
1.1 KiB
Diff
Raw Normal View History

From: Evgeni Golov <sargentd@die-welt.net>
Date: Wed, 5 Mar 2014 17:46:07 +0100
Subject: sidebar-delimnullwide
SidebarDelim can be NULL and strlen(NULL) is a bad idea, as it will segfault.
Wrap it with NONULL().
While at it, change strlen to mbstowcs for better utf8 support.
Closes: #696145, #663883
Gbp-Pq: Topic mutt-patched
---
sidebar.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sidebar.c b/sidebar.c
index 51a25ca..c3ea338 100644
--- a/sidebar.c
+++ b/sidebar.c
@@ -88,7 +88,7 @@ char *make_sidebar_entry(char *box, int size, int new, int flagged)
int box_len, box_bytes;
int int_len;
int right_offset = 0;
- int delim_len = strlen(SidebarDelim);
+ int delim_len = mbstowcs(NULL, NONULL(SidebarDelim), 0);
static char *entry;
right_width = left_width = 0;
@@ -178,7 +178,7 @@ int draw_sidebar(int menu) {
#ifndef USE_SLANG_CURSES
attr_t attrs;
#endif
- short delim_len = strlen(SidebarDelim);
+ short delim_len = mbstowcs(NULL, NONULL(SidebarDelim), 0);
short color_pair;
static bool initialized = false;