Index: common/ioz.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/ioz.c,v
retrieving revision 1.3
diff -u -r1.3 ioz.c
--- ioz.c	2000/08/14 12:42:04	1.3
+++ ioz.c	2000/09/03 00:32:38
@@ -211,9 +211,10 @@
       char buffer[4096];
       int num;
       num = my_vsnprintf(buffer, sizeof(buffer), format, ap);
-      if (num >= sizeof(buffer)) {
-	freelog(LOG_ERROR, "Too much data: truncated in fz_fprintf (%d/%d)",
-		num, (int)sizeof(buffer));
+      /* Do not assume C99 vsnprintf(). */
+      if (num >= sizeof(buffer) || num == -1) {
+	freelog(LOG_ERROR, "Too much data: truncated in fz_fprintf (%d)",
+		(int)sizeof(buffer));
       }
       retval = gzwrite(fp->u.zlib, buffer, (unsigned int)strlen(buffer));
     }
Index: common/support.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/support.c,v
retrieving revision 1.9
diff -u -r1.9 support.c
--- support.c	2000/08/12 04:15:00	1.9
+++ support.c	2000/09/03 00:32:40
@@ -265,8 +265,8 @@
  our requirements; specifically:
  - Should actually obey the parameter n, rather than, eg, just
    calling sprintf and ignoring n.
- - On truncation, should return the number of chars (not counting
-   trailing null) which would have been printed, rather than, eg, -1.
+ - On truncation, should return either -1 or the number of chars (not
+   counting the trailing NUL) which would have been printed.
  Returns 1 if both ok.
  Also checks whether null-terminates on truncation, but we don't
  base return value on this since it is easy to force this behaviour.
@@ -297,7 +297,8 @@
   }
 #endif
 
-  return (buf[ntrunc]==one_past && ret==test_len);
+  return (buf[ntrunc] == one_past
+	  && (ret == test_len || ret == -1));
 }
 #endif
 
@@ -373,8 +374,8 @@
 
     if (native_is_ok) {
       int ret = vsnprintf(str, n, format, ap);
-      /* Guarantee null-terminated: (native_is_ok means can use ret like this) */
-      if (ret >= n) {
+      /* Guarantee NUL-terminated: */
+      if (ret >= n || ret == -1) {
 	str[n-1] = '\0';
       }
       return ret;
@@ -393,10 +394,8 @@
     }
 
 #ifdef HAVE_VSNPRINTF
-    /* This occurs if have native, but didn't pass check:
-     * may just be that native doesn't give the right return,
-     * in which case may be slightly safer to use it here:
-     */
+    /* This occurs if we have a native version, but it didn't pass the
+     * check, in which case it might be slightly safer to use it here: */
     vsnprintf(buf, VSNP_BUF_SIZE, format, ap);
 #else
     vsprintf(buf, format, ap);
Index: server/stdinhand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/stdinhand.c,v
retrieving revision 1.160
diff -u -r1.160 stdinhand.c
--- stdinhand.c	2000/09/01 13:34:38	1.160
+++ stdinhand.c	2000/09/03 00:32:55
@@ -2379,6 +2379,10 @@
   cmd_reply_show(horiz_line);
   len1 = my_snprintf(buf, sizeof(buf),
 	_("%-*s value   (min,max)      "), OPTION_NAME_SPACE, _("Option"));
+  if (len1 >= sizeof(buf) || len1 == -1) {
+    /* Don't assume C99 vsnprintf(). */
+    len1 = sizeof(buf) - 1;
+  }
   sz_strlcat(buf, _("description"));
   cmd_reply_show(buf);
   cmd_reply_show(horiz_line);
@@ -2405,6 +2409,10 @@
 		      may_set_option_now(caller,i) ? '+' : ' ',
 		      ((strcmp(op->svalue, op->default_svalue)==0) ? '=' : ' '),
 		      op->svalue);
+      }
+      if (len >= sizeof(buf) || len == -1) {
+	/* Don't assume C99 vsnprintf(). */
+	len = sizeof(buf) - 1;
       }
       /* Line up the descriptions: */
       if(len < len1) {