* otherwise assume that the GECOS field is a comma-separated list.
* Replace "&" by a capitalized version of the user's login name.
*/
* otherwise assume that the GECOS field is a comma-separated list.
* Replace "&" by a capitalized version of the user's login name.
*/
-ssize_t mutt_gecos_name(char *dst, ssize_t n, struct passwd *pw, regex_t *rx)
+ssize_t mutt_gecos_name(char *dst, ssize_t n, struct passwd *pw, rx_t *rx)
- if (regexec(rx, pw->pw_gecos, 1, pat_match, 0)) {
+ if (regexec(rx->rx, pw->pw_gecos, 1, pat_match, 0)) {
- len += m_strncpy(dst + len, n - len, p, q - p);
+ len += m_strncpy(dst + len, n - len, p, MIN(end, q) - p);
trailing_dot = q[-1] == '.';
if (!trailing_dot || q > p + 1) {
m_strncpy(s, n, p, q - trailing_dot - p);
trailing_dot = q[-1] == '.';
if (!trailing_dot || q > p + 1) {
m_strncpy(s, n, p, q - trailing_dot - p);