--- deliantra/server/common/utils.C 2009/10/11 01:35:53 1.87
+++ deliantra/server/common/utils.C 2009/10/15 21:09:32 1.90
@@ -5,18 +5,19 @@
* Copyright (©) 2002,2007 Mark Wedel & Crossfire Development Team
* Copyright (©) 1992,2007 Frank Tore Johansen
*
- * Deliantra is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
+ * Deliantra is free software: you can redistribute it and/or modify it under
+ * the terms of the Affero GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or (at your
+ * option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
+ * You should have received a copy of the Affero GNU General Public License
+ * and the GNU General Public License along with this program. If not, see
+ * .
*
* The authors can be reached via e-mail to
*/
@@ -461,7 +462,8 @@
bool safe = true;
/* Trying to cheat by getting data into the object */
- if (!strncmp (msg, "endmsg", strlen ("endmsg")) || strstr (msg, "\nendmsg"))
+ if (!strncmp (msg, "endmsg", sizeof ("endmsg") - 1)
+ || strstr (msg, "\nendmsg"))
safe = false;
/* Trying to make the object talk, and potentially access arbitrary code */
@@ -612,16 +614,20 @@
return len;
}
-const char *
-format (const char *format, ...)
+char *
+vformat (const char *format, va_list ap)
{
- static dynbuf_text buf;
-
- buf.clear ();
+ static dynbuf_text buf; buf.clear ();
+ buf.vprintf (format, ap);
+ return buf;
+}
+char *
+format (const char *format, ...)
+{
va_list ap;
va_start (ap, format);
- buf.vprintf (format, ap);
+ char *buf = vformat (format, ap);
va_end (ap);
return buf;