Explorar o código

* Made some large buffers quite smaller
* Added more format attributes


svn: 982

Bryan Drewery %!s(int64=22) %!d(string=hai) anos
pai
achega
78d8c05fa5
Modificáronse 16 ficheiros con 272 adicións e 160 borrados
  1. 8 4
      autotools/configure.ac
  2. 8 0
      config.h.in
  3. 217 119
      configure
  4. 2 0
      src/bg.c
  5. 2 7
      src/botmsg.c
  6. 0 1
      src/botmsg.h
  7. 1 1
      src/cmds.c
  8. 4 5
      src/crypt.c
  9. 1 1
      src/crypt.h
  10. 2 2
      src/debug.c
  11. 4 3
      src/misc.c
  12. 12 13
      src/mod/share.mod/share.c
  13. 1 1
      src/mod/share.mod/share.h
  14. 8 1
      src/shell.c
  15. 1 1
      src/tandem.h
  16. 1 1
      src/tclhash.c

+ 8 - 4
autotools/configure.ac

@@ -85,19 +85,23 @@ AC_TYPE_PID_T
 AC_TYPE_SIZE_T
 AC_TYPE_UID_T
 
+
 AC_C_CONST
+AC_C_VOLATILE
 AC_C_BIGENDIAN
 AC_C_INLINE
+AC_C_CHAR_UNSIGNED
+AC_C_STRINGIZE
+
+#checkpoint
+AC_CACHE_SAVE 
+
 AC_CHECK_SIZEOF(int, 0)
 AC_CHECK_SIZEOF(short, 0)
 AC_CHECK_SIZEOF(long, 0)
 AC_CHECK_SIZEOF(long long,0)
 
 
-#checkpoint
-AC_CACHE_SAVE 
-
-AC_C_VOLATILE
 AC_PROG_GCC_TRADITIONAL
 AC_STRUCT_TIMEZONE
 AC_STRUCT_TM

+ 8 - 0
config.h.in

@@ -141,6 +141,9 @@
 /* Define to 1 if you have the `strftime' function. */
 #undef HAVE_STRFTIME
 
+/* Define to 1 if cpp supports the ANSI # stringizing operator. */
+#undef HAVE_STRINGIZE
+
 /* Define to 1 if you have the <strings.h> header file. */
 #undef HAVE_STRINGS_H
 
@@ -305,6 +308,11 @@
 /* Define to 1 if you need to in order for `stat' and other things to work. */
 #undef _POSIX_SOURCE
 
+/* Define to 1 if type `char' is unsigned and you are not using gcc.  */
+#ifndef __CHAR_UNSIGNED__
+# undef __CHAR_UNSIGNED__
+#endif
+
 /* Define to empty if `const' does not conform to ANSI C. */
 #undef const
 

+ 217 - 119
configure

@@ -1,5 +1,5 @@
 #! /bin/sh
-# From configure.ac Revision: 1.24 .
+# From configure.ac Revision: 1.25 .
 # Guess values for system-dependent variables and create Makefiles.
 # Generated by GNU Autoconf 2.59.
 #
@@ -6264,6 +6264,7 @@ _ACEOF
 fi
 
 
+
 echo "$as_me:$LINENO: checking for an ANSI C-conforming const" >&5
 echo $ECHO_N "checking for an ANSI C-conforming const... $ECHO_C" >&6
 if test "${ac_cv_c_const+set}" = set; then
@@ -6370,6 +6371,68 @@ _ACEOF
 
 fi
 
+echo "$as_me:$LINENO: checking for working volatile" >&5
+echo $ECHO_N "checking for working volatile... $ECHO_C" >&6
+if test "${ac_cv_c_volatile+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+volatile int x;
+int * volatile y;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_c_volatile=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_c_volatile=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_c_volatile" >&5
+echo "${ECHO_T}$ac_cv_c_volatile" >&6
+if test $ac_cv_c_volatile = no; then
+
+cat >>confdefs.h <<\_ACEOF
+#define volatile
+_ACEOF
+
+fi
+
 echo "$as_me:$LINENO: checking whether byte ordering is bigendian" >&5
 echo $ECHO_N "checking whether byte ordering is bigendian... $ECHO_C" >&6
 if test "${ac_cv_c_bigendian+set}" = set; then
@@ -6667,6 +6730,159 @@ _ACEOF
     ;;
 esac
 
+
+echo "$as_me:$LINENO: checking whether char is unsigned" >&5
+echo $ECHO_N "checking whether char is unsigned... $ECHO_C" >&6
+if test "${ac_cv_c_char_unsigned+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((char) -1) < 0)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_c_char_unsigned=no
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_c_char_unsigned=yes
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_c_char_unsigned" >&5
+echo "${ECHO_T}$ac_cv_c_char_unsigned" >&6
+if test $ac_cv_c_char_unsigned = yes && test "$GCC" != yes; then
+  cat >>confdefs.h <<\_ACEOF
+#define __CHAR_UNSIGNED__ 1
+_ACEOF
+
+fi
+
+echo "$as_me:$LINENO: checking for preprocessor stringizing operator" >&5
+echo $ECHO_N "checking for preprocessor stringizing operator... $ECHO_C" >&6
+if test "${ac_cv_c_stringize+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#define x(y) #y
+
+char *s = x(teststring);
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "#teststring" >/dev/null 2>&1; then
+  ac_cv_c_stringize=no
+else
+  ac_cv_c_stringize=yes
+fi
+rm -f conftest*
+
+fi
+echo "$as_me:$LINENO: result: $ac_cv_c_stringize" >&5
+echo "${ECHO_T}$ac_cv_c_stringize" >&6
+if test $ac_cv_c_stringize = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_STRINGIZE 1
+_ACEOF
+
+fi
+
+
+#checkpoint
+cat >confcache <<\_ACEOF
+# This file is a shell script that caches the results of configure
+# tests run on this system so they can be shared between configure
+# scripts and configure runs, see configure's option --config-cache.
+# It is not useful on other systems.  If it contains results you don't
+# want to keep, you may remove or edit it.
+#
+# config.status only pays attention to the cache file if you give it
+# the --recheck option to rerun configure.
+#
+# `ac_cv_env_foo' variables (set or unset) will be overridden when
+# loading this file, other *unset* `ac_cv_foo' will be assigned the
+# following values.
+
+_ACEOF
+
+# The following way of writing the cache mishandles newlines in values,
+# but we know of no workaround that is simple, portable, and efficient.
+# So, don't put newlines in cache variables' values.
+# Ultrix sh set writes to stderr and can't be redirected directly,
+# and sets the high bit in the cache file unless we assign to the vars.
+{
+  (set) 2>&1 |
+    case `(ac_space=' '; set | grep ac_space) 2>&1` in
+    *ac_space=\ *)
+      # `set' does not quote correctly, so add quotes (double-quote
+      # substitution turns \\\\ into \\, and sed turns \\ into \).
+      sed -n \
+	"s/'/'\\\\''/g;
+	  s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
+      ;;
+    *)
+      # `set' quotes correctly as required by POSIX, so do not add quotes.
+      sed -n \
+	"s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
+      ;;
+    esac;
+} |
+  sed '
+     t clear
+     : clear
+     s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
+     t end
+     /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
+     : end' >>confcache
+if diff $cache_file confcache >/dev/null 2>&1; then :; else
+  if test -w $cache_file; then
+    test "x$cache_file" != "x/dev/null" 
+    cat confcache >$cache_file
+  else
+    echo "not updating unwritable cache $cache_file"
+  fi
+fi
+rm -f confcache
+
 echo "$as_me:$LINENO: checking for int" >&5
 echo $ECHO_N "checking for int... $ECHO_C" >&6
 if test "${ac_cv_type_int+set}" = set; then
@@ -8293,124 +8509,6 @@ _ACEOF
 
 
 
-#checkpoint
-cat >confcache <<\_ACEOF
-# This file is a shell script that caches the results of configure
-# tests run on this system so they can be shared between configure
-# scripts and configure runs, see configure's option --config-cache.
-# It is not useful on other systems.  If it contains results you don't
-# want to keep, you may remove or edit it.
-#
-# config.status only pays attention to the cache file if you give it
-# the --recheck option to rerun configure.
-#
-# `ac_cv_env_foo' variables (set or unset) will be overridden when
-# loading this file, other *unset* `ac_cv_foo' will be assigned the
-# following values.
-
-_ACEOF
-
-# The following way of writing the cache mishandles newlines in values,
-# but we know of no workaround that is simple, portable, and efficient.
-# So, don't put newlines in cache variables' values.
-# Ultrix sh set writes to stderr and can't be redirected directly,
-# and sets the high bit in the cache file unless we assign to the vars.
-{
-  (set) 2>&1 |
-    case `(ac_space=' '; set | grep ac_space) 2>&1` in
-    *ac_space=\ *)
-      # `set' does not quote correctly, so add quotes (double-quote
-      # substitution turns \\\\ into \\, and sed turns \\ into \).
-      sed -n \
-	"s/'/'\\\\''/g;
-	  s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
-      ;;
-    *)
-      # `set' quotes correctly as required by POSIX, so do not add quotes.
-      sed -n \
-	"s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
-      ;;
-    esac;
-} |
-  sed '
-     t clear
-     : clear
-     s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
-     t end
-     /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
-     : end' >>confcache
-if diff $cache_file confcache >/dev/null 2>&1; then :; else
-  if test -w $cache_file; then
-    test "x$cache_file" != "x/dev/null" 
-    cat confcache >$cache_file
-  else
-    echo "not updating unwritable cache $cache_file"
-  fi
-fi
-rm -f confcache
-
-echo "$as_me:$LINENO: checking for working volatile" >&5
-echo $ECHO_N "checking for working volatile... $ECHO_C" >&6
-if test "${ac_cv_c_volatile+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-int
-main ()
-{
-
-volatile int x;
-int * volatile y;
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_c_volatile=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_c_volatile=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-echo "$as_me:$LINENO: result: $ac_cv_c_volatile" >&5
-echo "${ECHO_T}$ac_cv_c_volatile" >&6
-if test $ac_cv_c_volatile = no; then
-
-cat >>confdefs.h <<\_ACEOF
-#define volatile
-_ACEOF
-
-fi
-
 if test $ac_cv_c_compiler_gnu = yes; then
     echo "$as_me:$LINENO: checking whether $CC needs -traditional" >&5
 echo $ECHO_N "checking whether $CC needs -traditional... $ECHO_C" >&6

+ 2 - 0
src/bg.c

@@ -19,6 +19,8 @@ time_t  lastfork = 0;
  * process to the background. This includes writing a PID file
  * and informing the user of the split.
  */
+static void bg_do_detach(pid_t) __attribute__((noreturn));
+
 static void bg_do_detach(pid_t p)
 {
   FILE *fp = NULL;

+ 2 - 7
src/botmsg.c

@@ -277,18 +277,13 @@ void botnet_send_pong(int idx)
   tputs(dcc[idx].sock, "po\n", 3);
 }
 
-void botnet_send_priv (int idx, ...)
+void botnet_send_priv (int idx, char *from, char *to, char *tobot, char *format, ...)
 {
   size_t len;
-  char *from = NULL, *to = NULL, *tobot = NULL, *format = NULL;
   char tbuf[1024] = "";
   va_list va;
 
-  va_start(va, idx);
-  from = va_arg(va, char *);
-  to = va_arg(va, char *);
-  tobot = va_arg(va, char *);
-  format = va_arg(va, char *);
+  va_start(va, format);
   egg_vsnprintf(tbuf, 450, format, va);
   va_end(va);
   tbuf[sizeof(tbuf)-1] = 0;

+ 0 - 1
src/botmsg.h

@@ -19,7 +19,6 @@ void putbot(char *, char *);
 __inline__ void putallbots(char *);
 int add_note(char *, char *, char *, int, int);
 size_t simple_sprintf (char *, ...);
-void tandout_but (int, ...);
 char *int_to_base10(int);
 char *unsigned_int_to_base10(unsigned int);
 char *int_to_base64(unsigned int);

+ 1 - 1
src/cmds.c

@@ -45,7 +45,7 @@
 
 extern egg_traffic_t 	traffic;
 
-mycmds 			 cmdlist[500]; /* the list of dcc cmds for help system */
+mycmds 			 cmdlist[300]; /* the list of dcc cmds for help system */
 int    			 cmdi = 0;
 
 static char		 *btos(unsigned long);

+ 4 - 5
src/crypt.c

@@ -59,7 +59,7 @@ char *decrypt_binary(const char *keydata, unsigned char *data, int datalen)
   unsigned char *newdata = NULL;
 
   datalen -= datalen % CRYPT_BLOCKSIZE;
-  newdata = (unsigned char *) calloc(1, datalen);
+  newdata = calloc(1, datalen);
   egg_memcpy(newdata, data, datalen);
 
   if ((!keydata) || (!keydata[0])) {
@@ -170,15 +170,14 @@ void encrypt_pass(char *s1, char *s2)
   free(tmp);
 }
 
-int lfprintf (FILE *stream, ...)
+int lfprintf (FILE *stream, char *format, ...)
 {
   va_list va;
-  char buf[8192], *ln = NULL, *nln = NULL, *tmp = NULL, *format = NULL;
+  char buf[8192], *ln = NULL, *nln = NULL, *tmp = NULL;
   int res;
 
   buf[0] = 0;
-  va_start(va, stream);
-  format = va_arg(va, char *);
+  va_start(va, format);
   egg_vsnprintf(buf, sizeof buf, format, va);
   va_end(va);
 

+ 1 - 1
src/crypt.h

@@ -21,7 +21,7 @@ char *decrypt_string(const char *, char *);
 void encrypt_pass(char *, char *);
 char *cryptit (char *);
 char *decryptit (char *);
-int lfprintf (FILE *, ...);
+int lfprintf (FILE *, char *, ...) __attribute__((format(printf, 2, 3)));
 void Encrypt_File(char *, char *);
 void Decrypt_File(char *, char *);
 char *btoh(const unsigned char *, int);

+ 2 - 2
src/debug.c

@@ -31,8 +31,8 @@ int		sdebug = 0;             /* enable debug output? */
 
 #ifdef DEBUG_CONTEXT
 /* Context storage for fatal crashes */
-char    cx_file[16][30]; 
-char    cx_note[16][256];
+char    cx_file[16][15]; 
+char    cx_note[16][21];
 int     cx_line[16] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
 int     cx_ptr = 0;
 #endif /* DEBUG_CONTEXT */

+ 4 - 3
src/misc.c

@@ -1076,14 +1076,14 @@ char *replace(const char *string, const char *oldie, const char *newbie)
 #define HELP_UNDER 4
 #define HELP_FLASH 8
 
-/* so many string++ is making the problem */
-void showhelp (int idx, struct flag_record *flags, char *string)
+void showhelp(int idx, struct flag_record *flags, char *string)
 {
   static int help_flags;
   struct flag_record fr = {FR_GLOBAL | FR_CHAN, 0, 0};
-  char helpstr[12288] = "", tmp[2] = "", flagstr[10] = "";
+  char *helpstr = NULL, tmp[2] = "", flagstr[10] = "";
   int ok = 1;
 
+  helpstr = calloc(1, strlen(string) + 1000 + 1);
   while (string && string[0]) {
     if (*string == '%') {
       if (!strncmp(string + 1, "{+", 2)) {
@@ -1167,6 +1167,7 @@ void showhelp (int idx, struct flag_record *flags, char *string)
   }
   helpstr[strlen(helpstr)] = 0;
   if (helpstr[0]) dumplots(idx, "", helpstr);
+  free(helpstr);
 }
 
 /* Arrange the N elements of ARRAY in random order. */

+ 12 - 13
src/mod/share.mod/share.c

@@ -49,7 +49,7 @@ static struct delay_mode *start_delay = NULL;
 #ifdef HUB
 static void start_sending_users(int);
 #endif /* HUB */
-static void shareout_but(struct chanset_t *, ...);
+static void shareout_but(struct chanset_t *chan, int, char *, ...) __attribute__((format(printf, 3, 4)));
 static void cancel_user_xfer(int, void *);
 
 #include "share.h"
@@ -1157,45 +1157,44 @@ sharein(int idx, char *msg)
 }
 
 void
-shareout(struct chanset_t *chan, ...)
+shareout(struct chanset_t *chan, char *format, ...)
 {
   int i, l;
-  char *format = NULL, s[601] = "";
+  char s[601] = "";
   va_list va;
 
-  va_start(va, chan);
-  format = va_arg(va, char *);
+  va_start(va, format);
 
   strcpy(s, "s ");
   if ((l = egg_vsnprintf(s + 2, 509, format, va)) < 0)
     s[2 + (l = 509)] = 0;
+  va_end(va);
+
   for (i = 0; i < dcc_total; i++)
     if ((dcc[i].type->flags & DCT_BOT) && (dcc[i].status & STAT_SHARE) && !(dcc[i].status & (STAT_GETTING | STAT_SENDING))) {
       tputs(dcc[i].sock, s, l + 2);
     }
-  va_end(va);
 }
 
 static void
-shareout_but(struct chanset_t *chan, ...)
+shareout_but(struct chanset_t *chan, int x, char *format, ...)
 {
-  int i, x, l;
-  char *format = NULL, s[601] = "";
+  int i, l;
+  char s[601] = "";
   va_list va;
 
-  va_start(va, chan);
-  x = va_arg(va, int);
-  format = va_arg(va, char *);
+  va_start(va, format);
 
   strcpy(s, "s ");
   if ((l = egg_vsnprintf(s + 2, 509, format, va)) < 0)
     s[2 + (l = 509)] = 0;
+  va_end(va);
+
   for (i = 0; i < dcc_total; i++)
     if ((dcc[i].type->flags & DCT_BOT) && (i != x) &&
         (dcc[i].status & STAT_SHARE) && (!(dcc[i].status & STAT_GETTING)) && (!(dcc[i].status & STAT_SENDING))) {
       tputs(dcc[i].sock, s, l + 2);
     }
-  va_end(va);
 }
 
 #ifdef HUB

+ 1 - 1
src/mod/share.mod/share.h

@@ -11,7 +11,7 @@
 #define UFF_EXEMPT	BIT2	/* Send exempts in user file	    */
 
 void sharein(int, char *);
-void shareout(struct chanset_t *, ...);
+void shareout(struct chanset_t *, char *, ...) __attribute__((format(printf, 2, 3)));
 void finish_share(int);
 void dump_resync(int);
 void share_report(int, int);

+ 8 - 1
src/shell.c

@@ -237,18 +237,22 @@ void check_promisc()
 #ifdef SIOCGIFCONF
   struct ifreq ifreq, *ifr = NULL;
   struct ifconf ifcnf;
-  char *cp = NULL, *cplim = NULL, buf[8192] = "";
+  char *cp = NULL, *cplim = NULL, *buf = NULL;
   int sock;
 
   if (!strcmp((char *) CFG_PROMISC.ldata ? CFG_PROMISC.ldata : CFG_PROMISC.gdata ? CFG_PROMISC.gdata : "ignore", "ignore"))
     return;
+
   sock = socket(AF_INET, SOCK_STREAM, 0);
   if (sock < 0)
     return;
+  buf = calloc(1, 8192);
+
   ifcnf.ifc_len = 8191;
   ifcnf.ifc_buf = buf;
   if (ioctl(sock, SIOCGIFCONF, (char *) &ifcnf) < 0) {
     close(sock);
+    free(buf);
     return;
   }
   ifr = ifcnf.ifc_req;
@@ -260,10 +264,13 @@ void check_promisc()
       if (ifreq.ifr_flags & IFF_PROMISC) {
         close(sock);
         detected(DETECT_PROMISC, "Detected promiscuous mode");
+        free(buf);
         return;
       }
     }
   }
+  if (buf)
+    free(buf);
   close(sock);
 #endif /* SIOCGIFCONF */
 #endif /* S_PROMISC */

+ 1 - 1
src/tandem.h

@@ -48,7 +48,7 @@ void botnet_send_chat(int, char *, char *);
 void botnet_send_act(int, char *, char *, int, char *);
 void botnet_send_ping(int);
 void botnet_send_pong(int);
-void botnet_send_priv (int, ...);
+void botnet_send_priv (int, char *, char *, char *, char *, ...) __attribute__((format(printf, 5, 6)));
 void botnet_send_who(int, char *, char *, int);
 void botnet_send_infoq(int, char *);
 void botnet_send_unlinked(int, char *, char *);

+ 1 - 1
src/tclhash.c

@@ -358,7 +358,7 @@ int check_bind(bind_table_t *table, const char *match, struct flag_record *flags
 	return ret;
 }
 
-int check_bind_hits(bind_table_t *table, const char *match, struct flag_record *flags, int *hits,...)
+int check_bind_hits(bind_table_t *table, const char *match, struct flag_record *flags, int *hits, ...)
 {
         va_list args;
         int ret;