Index: .gitignore
===================================================================
--- .gitignore	(revision 42ad91716a0f429f02385235acffa71546e28caa)
+++ .gitignore	(revision 1703f7231e2822e81916109bafcfebee606f7beb)
@@ -4,4 +4,5 @@
 *~
 .#*
+.*.swp
 .deps
 META.yml
Index: Makefile.am
===================================================================
--- Makefile.am	(revision 39e81f799239d76e4d42870e6aabcb35d6e2c059)
+++ Makefile.am	(revision b373d4433450dc226e49ae0d4eda3542c4a42904)
@@ -20,9 +20,8 @@
 perl_tester_SOURCES = $(BASE_SRCS) \
      owl.h owl_perl.h config.h \
-     libzcrypt.a \
      $(GEN_C) $(GEN_H) \
      perl_tester.c
 
-perl_tester_LDADD = libfaim/libfaim.a libzcrypt.a
+perl_tester_LDADD = libfaim/libfaim.a
 
 TESTS=runtests.sh
Index: commands.c
===================================================================
--- commands.c	(revision 61de0850fedd7ac9f03bd5642d1ea9fc10d970e9)
+++ commands.c	(revision 5ade618c57cac0be3d8abfc5ec361c636937bb78)
@@ -861,5 +861,5 @@
   OWLCMD_VOID_CTX("edit:history-next", owl_command_edit_history_next, 
 		  OWL_CTX_EDIT,
-		  "replaces the text with the previous history",
+		  "replaces the text with the next history",
 		  "", ""),
 
Index: editwin.c
===================================================================
--- editwin.c	(revision 2184001c40142118127a6101aeb6da9357898928)
+++ editwin.c	(revision 6c171f190998142df485a1f93b4ef7bad5a8ea57)
@@ -326,19 +326,13 @@
 static void oe_release_excursion(owl_editwin *e, oe_excursion *x)
 {
-  oe_excursion *p;
+  oe_excursion **px;
 
   x->valid = 0;
-  if (e->excursions == NULL)
-    /* XXX huh. */ ;
-  else if (e->excursions == x)
-    e->excursions = x->next;
-  else {
-    for (p = e->excursions; p->next != NULL; p = p->next)
-      if (p->next == x) {
-	p->next = p->next->next;
-	break;
-      }
-    /* and if we ran off the end? XXX */
-  }
+  for (px = &e->excursions; *px != NULL; px = &(*px)->next)
+    if (*px == x) {
+      *px = x->next;
+      return;
+    }
+  abort();
 }
 
@@ -1258,6 +1252,4 @@
 
   if (!g_unichar_iscntrl(c) || c == '\n' || c== '\t' ) {
-    memset(tmp, 0, 7);
-
     if (c == '\n' && e->style == OWL_EDITWIN_STYLE_ONELINE) {
       return;
@@ -1302,5 +1294,5 @@
       return; /* our work here is done */
 
-    g_unichar_to_utf8(c, tmp);
+    tmp[g_unichar_to_utf8(c, tmp)] = '\0';
     owl_editwin_replace(e, 0, tmp);
   }
Index: fmtext.c
===================================================================
--- fmtext.c	(revision f119757ac31f8512736f47ad09423377daa09f80)
+++ fmtext.c	(revision 6c171f190998142df485a1f93b4ef7bad5a8ea57)
@@ -57,19 +57,13 @@
 
   /* Set attributes */
-  if (a) {
-    memset(attrbuff,0,6);
-    g_unichar_to_utf8(OWL_FMTEXT_UC_ATTR | attr, attrbuff);
-    strcat(f->textbuff, attrbuff);      
-  }
-  if (fg) {
-    memset(attrbuff,0,6);
-    g_unichar_to_utf8(OWL_FMTEXT_UC_FGCOLOR | fgcolor, attrbuff);
-    strcat(f->textbuff, attrbuff);      
-  }
-  if (bg) {
-    memset(attrbuff,0,6);
-    g_unichar_to_utf8(OWL_FMTEXT_UC_BGCOLOR | bgcolor, attrbuff);
-    strcat(f->textbuff, attrbuff);      
-  }
+  if (a)
+    strncat(f->textbuff, attrbuff,
+	    g_unichar_to_utf8(OWL_FMTEXT_UC_ATTR | attr, attrbuff));
+  if (fg)
+    strncat(f->textbuff, attrbuff,
+	    g_unichar_to_utf8(OWL_FMTEXT_UC_FGCOLOR | fgcolor, attrbuff));
+  if (bg)
+    strncat(f->textbuff, attrbuff,
+	    g_unichar_to_utf8(OWL_FMTEXT_UC_BGCOLOR | bgcolor, attrbuff));
   
   strcat(f->textbuff, text);
@@ -202,19 +196,13 @@
   _owl_fmtext_realloc(f, newlen);
 
-  if (a) {
-    memset(attrbuff,0,6);
-    g_unichar_to_utf8(OWL_FMTEXT_UC_ATTR | attr, attrbuff);
-    strcat(f->textbuff, attrbuff);      
-  }
-  if (fg) {
-    memset(attrbuff,0,6);
-    g_unichar_to_utf8(OWL_FMTEXT_UC_FGCOLOR | fgcolor, attrbuff);
-    strcat(f->textbuff, attrbuff);      
-  }
-  if (bg) {
-    memset(attrbuff,0,6);
-    g_unichar_to_utf8(OWL_FMTEXT_UC_BGCOLOR | bgcolor, attrbuff);
-    strcat(f->textbuff, attrbuff);      
-  }
+  if (a)
+    strncat(f->textbuff, attrbuff,
+	    g_unichar_to_utf8(OWL_FMTEXT_UC_ATTR | attr, attrbuff));
+  if (fg)
+    strncat(f->textbuff, attrbuff,
+	    g_unichar_to_utf8(OWL_FMTEXT_UC_FGCOLOR | fgcolor, attrbuff));
+  if (bg)
+    strncat(f->textbuff, attrbuff,
+	    g_unichar_to_utf8(OWL_FMTEXT_UC_BGCOLOR | bgcolor, attrbuff));
 
   strncat(f->textbuff, in->textbuff+start, stop-start+1);
@@ -315,4 +303,8 @@
 	int start, end;
 	while (owl_regex_compare(owl_global_get_search_re(&g), s, &start, &end) == 0) {
+	  /* Prevent an infinite loop matching the empty string. */
+	  if (end == 0)
+	    break;
+
 	  /* Found search string, highlight it. */
 
Index: functions.c
===================================================================
--- functions.c	(revision 340c3e79617a8c1179a58118a0f7adbb87fc40d4)
+++ functions.c	(revision dca3b27c476353ad24df77afcfcd5fbf685e836d)
@@ -1941,5 +1941,6 @@
 {
   owl_fmtext fm;
-  char *ptr, buff[LINE];
+  char *ptr;
+  char *result;
   int i;
 
@@ -1947,7 +1948,8 @@
 
   for (i=0; i<argc; i++) {
-    ptr=long_zuser(argv[i]);
-    owl_zephyr_zlocate(ptr, buff, auth);
-    owl_fmtext_append_normal(&fm, buff);
+    ptr = long_zuser(argv[i]);
+    result = owl_zephyr_zlocate(ptr, auth);
+    owl_fmtext_append_normal(&fm, result);
+    owl_free(result);
     owl_free(ptr);
   }
Index: perl/lib/BarnOwl.pm
===================================================================
--- perl/lib/BarnOwl.pm	(revision de3f6412cb0dc1b4e1044541558395c4c1fd807c)
+++ perl/lib/BarnOwl.pm	(revision 77c87b2b8f0028eea432fb75a14183ed321f5f1c)
@@ -435,17 +435,13 @@
 sub default_zephyr_signature
 {
-  if (my $zsig = getvar('zsig')) {
-    return $zsig;
+  my $zsig = getvar('zsig');
+  if (!$zsig && (my $zsigproc = getvar('zsigproc'))) {
+    $zsig = `$zsigproc`;
+  } elsif (!defined($zsig = get_zephyr_variable('zwrite-signature'))) {
+    $zsig = ((getpwuid($<))[6]);
+    $zsig =~ s/,.*//;
   }
-  if (my $zsigproc = getvar('zsigproc')) {
-    return `$zsigproc`;
-  }
-  my $zwrite_signature = get_zephyr_variable('zwrite-signature');
-  if (defined($zwrite_signature)) {
-    return $zwrite_signature;
-  }
-  my $name = ((getpwuid($<))[6]);
-  $name =~ s/,.*//;
-  return $name;
+  chomp($zsig);
+  return $zsig;
 }
 
Index: perl/modules/Jabber/lib/BarnOwl/Module/Jabber.pm
===================================================================
--- perl/modules/Jabber/lib/BarnOwl/Module/Jabber.pm	(revision 5118b3217a9478ce3deb0a9b7299f98b554fa075)
+++ perl/modules/Jabber/lib/BarnOwl/Module/Jabber.pm	(revision 26cde205cd3bb7efbb854fcbb1984776650a4a7f)
@@ -321,5 +321,5 @@
               . "add <jid>     Adds <jid> to your roster.\n\n"
               . "unsub <jid>   Unsubscribe from <jid>'s presence.\n\n"
-              . "remove <jid>  Removes <jid> to your roster. (implicit unsub)\n\n"
+              . "remove <jid>  Removes <jid> from your roster. (implicit unsub)\n\n"
               . "auth <jid>    Authorizes <jid> to subscribe to your presence.\n\n"
               . "deauth <jid>  De-authorizes <jid>'s subscription to your presence.\n\n"
Index: perl_tester.c
===================================================================
--- perl_tester.c	(revision 42ad91716a0f429f02385235acffa71546e28caa)
+++ perl_tester.c	(revision 737b8f16912a0ac4905cb24609e3980fc2378717)
@@ -32,4 +32,5 @@
   perl_free(my_perl);
   PERL_SYS_TERM();
+  return 0;
 }
 
Index: perlglue.xs
===================================================================
--- perlglue.xs	(revision 39e81f799239d76e4d42870e6aabcb35d6e2c059)
+++ perlglue.xs	(revision 5791bf749e1cf8fcf653cee9840ad05eedd577ad)
@@ -142,5 +142,6 @@
 		if (rv) owl_free(rv);
 
-void queue_message(msg) 
+void
+queue_message(msg)
 	SV *msg
 	PREINIT:
@@ -157,5 +158,6 @@
 	}
 
-void admin_message(header, body) 
+void
+admin_message(header, body)
 	const char *header
 	const char *body
@@ -165,5 +167,6 @@
 	}
 
-void start_question(line, callback)
+void
+start_question(line, callback)
 	const char *line
 	SV *callback
@@ -180,5 +183,6 @@
 	}
 
-void start_password(line, callback)
+void
+start_password(line, callback)
 	const char *line
 	SV *callback
@@ -195,5 +199,6 @@
 	}
 
-void start_edit_win(line, callback)
+void
+start_edit_win(line, callback)
 	const char *line
 	SV *callback
Index: zephyr.c
===================================================================
--- zephyr.c	(revision c79a04782cf599c7fdc305dbe33acb4b8842c771)
+++ zephyr.c	(revision dca3b27c476353ad24df77afcfcd5fbf685e836d)
@@ -911,5 +911,5 @@
 #endif
 
-void owl_zephyr_zlocate(const char *user, char *out, int auth)
+char *owl_zephyr_zlocate(const char *user, int auth)
 {
 #ifdef HAVE_LIBZEPHYR
@@ -918,29 +918,32 @@
   ZLocations_t locations;
   char *myuser;
-  
-  strcpy(out, "");
+  char *p, *result;
+
   ZResetAuthentication();
-  ret=ZLocateUser(zstr(user),&numlocs,auth?ZAUTH:ZNOAUTH);
-  if (ret != ZERR_NONE) {
-    sprintf(out, "Error locating user %s\n", user);
-    return;
-  }
-
-  if (numlocs==0) {
-    myuser=short_zuser(user);
-    sprintf(out, "%s: Hidden or not logged in\n", myuser);
-    owl_free(myuser);
-    return;
-  }
-    
-  for (;numlocs;numlocs--) {
-    ZGetLocations(&locations,&one);
-    myuser=short_zuser(user);
-    sprintf(out + strlen(out), "%s: %s\t%s\t%s\n", myuser,
-	    locations.host ? locations.host : "?",
-	    locations.tty ? locations.tty : "?",
-	    locations.time ? locations.time : "?");
-    owl_free(myuser);
-  }
+  ret = ZLocateUser(zstr(user), &numlocs, auth ? ZAUTH : ZNOAUTH);
+  if (ret != ZERR_NONE)
+    return owl_sprintf("Error locating user %s: %s\n",
+		       user, error_message(ret));
+
+  myuser = short_zuser(user);
+  if (numlocs == 0) {
+    result = owl_sprintf("%s: Hidden or not logged in\n", myuser);
+  } else {
+    result = owl_strdup("");
+    for (; numlocs; numlocs--) {
+      ZGetLocations(&locations, &one);
+      p = owl_sprintf("%s%s: %s\t%s\t%s\n",
+			  result, myuser,
+			  locations.host ? locations.host : "?",
+			  locations.tty ? locations.tty : "?",
+			  locations.time ? locations.time : "?");
+      owl_free(result);
+      result = p;
+    }
+  }
+
+  return result;
+#else
+  return owl_strdup("");
 #endif
 }
