[stunnel-users] netword.c & fdprintf access access violation fix

Alexey Drozdov anyquist at yandex.ru
Mon Sep 12 22:02:28 CEST 2011


Hi, all

One more bug was found out at work stunnel through a proxy.
There is a reference to already released memory in fdprintf function.

Here a small fix of this situation:

*** network.c   2011-09-07 20:46:19.000000000 +0400
--- network.c_patch     2011-09-12 23:52:46.015618574 +0400
***************
*** 766,771 ****
--- 766,772 ----
  int fdprintf(CLI *c, int fd, const char *format, ...) {
      va_list ap;
      char *line;
+     int outsize;

      va_start(ap, format);
      line=str_vprintf(format, ap);
***************
*** 775,782 ****
          longjmp(c->err, 1);
      }
      fdputline(c, fd, line);
      str_free(line);
!     return strlen(line)+2;
  }

  #define INET_SOCKET_PAIR
--- 776,784 ----
          longjmp(c->err, 1);
      }
      fdputline(c, fd, line);
+     outsize = strlen(line)+2;
      str_free(line);
!     return outsize;
  }

  #define INET_SOCKET_PAIR

/ Alexey Drozdov





More information about the stunnel-users mailing list