<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Recent changes to bugs</title><link>https://sourceforge.net/p/threads/bugs/</link><description>Recent changes to bugs</description><atom:link href="https://sourceforge.net/p/threads/bugs/feed.rss" rel="self"/><language>en</language><lastBuildDate>Fri, 12 Oct 2001 19:37:17 -0000</lastBuildDate><atom:link href="https://sourceforge.net/p/threads/bugs/feed.rss" rel="self" type="application/rss+xml"/><item><title>Program exit</title><link>https://sourceforge.net/p/threads/bugs/3/</link><description>&lt;div class="markdown_content"&gt;&lt;p&gt;When a thread uses global semaphores, mutex or &lt;br /&gt;
condition varibles and is not finished, and not &lt;br /&gt;
detached when the main program exits.  It segfaults &lt;br /&gt;
or hangs the main program.&lt;/p&gt;&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Bjarne Orn Hansen</dc:creator><pubDate>Fri, 12 Oct 2001 19:37:17 -0000</pubDate><guid>https://sourceforge.netd51bc064acf15af6783fcb8c94255e381eff1ae4</guid></item><item><title>Thread collition</title><link>https://sourceforge.net/p/threads/bugs/2/</link><description>&lt;div class="markdown_content"&gt;&lt;p&gt;Two simultaneous threads will collide, if run &lt;br /&gt;
extensively and using the standard template library.&lt;/p&gt;&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Anonymous</dc:creator><pubDate>Sun, 07 Oct 2001 13:20:29 -0000</pubDate><guid>https://sourceforge.netd0edb6a49f5e737cb72e6e454efb1f9fedbc3d00</guid></item><item><title>Buffer overflow risk</title><link>https://sourceforge.net/p/threads/bugs/1/</link><description>&lt;div class="markdown_content"&gt;&lt;p&gt;Hi guys, &lt;/p&gt;
&lt;p&gt;while looking at the threads source code in order to &lt;br /&gt;
decide whether to use it for a project on a GPL'ed &lt;br /&gt;
network server a bug popped to my eyes: &lt;/p&gt;
&lt;p&gt;-------&amp;amp;lt;shared.C&amp;amp;gt;---------&lt;br /&gt;
void shared_mem::change_proj(const char *p_root)&lt;br /&gt;
{&lt;br /&gt;
strncpy( _key_root,p_root,79 );&lt;br /&gt;
}&lt;br /&gt;
---------------------------&lt;br /&gt;
...is unsafe because the strncpy() copies just the &lt;br /&gt;
first 79 bytes leavind the dest string unterminated &lt;br /&gt;
in case the source is longer. &lt;br /&gt;
In combination with...&lt;br /&gt;
---------&amp;amp;lt;shared.C&amp;amp;gt;-----------&lt;br /&gt;
int shared_mem::create_proj(const char *p_id)&lt;br /&gt;
{&lt;br /&gt;
int fd;&lt;br /&gt;
&amp;amp;gt;  string s = _key_root;&lt;br /&gt;
sto_iterator i;&lt;br /&gt;
-----------------------------&lt;br /&gt;
...this is unsafe as the string assignment relies &lt;br /&gt;
on proper termination. &lt;/p&gt;
&lt;p&gt;BTW, I really don't understand why you're using a &lt;br /&gt;
damn 80 char limit on _key_root. If you really have &lt;br /&gt;
to use a limit, then I would appreciate a &lt;br /&gt;
#define or const int for the limit. &lt;br /&gt;
Maybe you should also check the calls to strcpy() &lt;br /&gt;
in mutex.C, cond.C, semaphore.C: &lt;br /&gt;
Why not use something like&lt;br /&gt;
------&amp;amp;lt;snip&amp;amp;gt;-------&lt;br /&gt;
void semaphore::project_part(const char *p_part)&lt;br /&gt;
{&lt;br /&gt;
if(s_project)  delete[] s_project;&lt;br /&gt;
size_t len = p_part ? strlen(p_part) : 0;&lt;br /&gt;
s_project = new char[len+1];&lt;br /&gt;
*s_project='\0';&lt;br /&gt;
if(p_part)  strcpy(s_project,p_part);&lt;br /&gt;
}&lt;br /&gt;
----------------&lt;br /&gt;
(assuming that the s_project pointer may change and &lt;br /&gt;
the function is not critical to runtime efficiancy.) &lt;/p&gt;
&lt;p&gt;Regards, &lt;br /&gt;
W. Wieser&lt;/p&gt;
&lt;p&gt;Please drop me an e-mail to &lt;br /&gt;
wwieser@users.sourceforge.net when you have read &lt;br /&gt;
this as I don't know if you're using the bug tracking &lt;br /&gt;
system. &lt;/p&gt;&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Wolfgang Wieser</dc:creator><pubDate>Wed, 18 Jul 2001 17:28:18 -0000</pubDate><guid>https://sourceforge.netf958d9e8479fe1b32a33dd98651f5fda9d24664a</guid></item></channel></rss>