[stunnel-users] Critical error on stunnel 434 for WinCE/Windows Mobile: no service at all, because of failure in thread creation

Pierre DELAAGE delaage.pierre at free.fr
Sat Sep 25 23:05:53 CEST 2010


Hello Michal,
Maybe you remember me, I am the man that refreshed stunnel for winCE up 
to 4.27 version.
Thank you for having included my code to your mainstream at that time.
As a win32 regular programmer I always check that my code is as close as 
possible as that of the main win32 stream for PC.

I am writing you today to point out a critical bug that prevent stunnel 
4.34  from servicing any service at all .

I have fixed that bug and will send you a refresh of all the sources 
(that needed some after some win32 PC version updates) soon.

SO DO NOT DO ANYTHING.

the bug is in sthread.c:
the wince _beginthread port has been modified (by someone else but me) 
as this :

v434:
handle=CreateThread(NULL, stack_size,
         (LPTHREAD_START_ROUTINE)start_address, arglist,
         STACK_SIZE_PARAM_IS_A_RESERVATION, &thread_id);

the "STACK_SIZE_PARAM_IS_A_RESERVATION" flag is the novelty from 4.27.
The problem is that beginthread is being called from gui.c with stacksize=0
SO THAT a stack of 0 size "TRIES to be  RESERVED" and then CreateThread 
FAILS to return a valid handle.

That is to say that no thread is created, and thus NO TUNNELING SERVICE 
at all can be delivered.
So stunnel cannot work at all.

Solution : the proper call is :

handle=CreateThread(NULL, stack_size,
         (LPTHREAD_START_ROUTINE)start_address, arglist,
         (stack_size > 0) ? STACK_SIZE_PARAM_IS_A_RESERVATION:0, 
&thread_id);

I repeat and insist : please DO NOT DO anything to the code, as I will 
send soon a refresh with various other updates (because apart from that 
critical bug,
the code needs other refresh to compile properly),
and as I am also working on a refresh of openssl up to 1.0.0a (those 
gentlemen at openssl never included any wce patch to their mainstream,
which is really a pity, but another story).

See you soon,
Thank you again for all the work you do for the community of people,

Pierre


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.stunnel.org/pipermail/stunnel-users/attachments/20100925/7b1f84be/attachment.html>


More information about the stunnel-users mailing list