missing dependency on the lib-sys.
authorPierre Habouzit <madcoder@debian.org>
Sun, 18 Mar 2007 23:19:31 +0000 (00:19 +0100)
committerPierre Habouzit <madcoder@debian.org>
Sun, 18 Mar 2007 23:19:31 +0000 (00:19 +0100)
Hall of Shame in mutt_gecos_name.

Makefile.am
lib-sys/unix.c

index 65c1bee..bd8aab9 100644 (file)
@@ -48,6 +48,7 @@ madmutt_DEPENDENCIES = $(top_builddir)/lib-lua/madmutt.li \
                       $(top_builddir)/lib-mime/libmime.a \
                       $(top_builddir)/lib-crypt/libcrypt.a \
                       $(top_builddir)/lib-hash/libhash.a \
+                      $(top_builddir)/lib-sys/libsys.a \
                       $(top_builddir)/lib-ui/libui.a \
                       $(top_builddir)/lib-lua/liblua.a \
                       $(top_builddir)/lib-mx/libmx.a \
index 9054435..3e2c23d 100644 (file)
@@ -39,16 +39,16 @@ ssize_t mutt_gecos_name(char *dst, ssize_t n, struct passwd *pw, rx_t *rx)
         }
 
         p   = pw->pw_gecos + pat_match[0].rm_so;
-        end = pw->pw_gecos + pat_match[0].rm_so;
+        end = pw->pw_gecos + pat_match[0].rm_eo;
     } else {
         p   = pw->pw_gecos;
         end = m_strchrnul(pw->pw_gecos, ',');
     }
 
     for (;;) {
-        const char *q = MIN(end, m_strchrnul(p, '&'));
+        const char *q = m_strchrnul(p, '&');
 
-        len += m_strncpy(dst + len, n - len, p, q - p);
+        len += m_strncpy(dst + len, n - len, p, MIN(end, q) - p);
         p = q + 1;
 
         if (!p[-1] || p >= end)