<html>#2750: HTTPD: Array access out of bounds
<table style='border-spacing: 1ex 0pt; '>
<tr><td style='text-align:right'> Reporter:</td><td>Erik Schnetter</td></tr>
<tr><td style='text-align:right'>   Status:</td><td>new</td></tr>
<tr><td style='text-align:right'>Milestone:</td><td></td></tr>
<tr><td style='text-align:right'>  Version:</td><td></td></tr>
<tr><td style='text-align:right'>     Type:</td><td>bug</td></tr>
<tr><td style='text-align:right'> Priority:</td><td>minor</td></tr>
<tr><td style='text-align:right'>Component:</td><td>EinsteinToolkit thorn</td></tr>
</table>

<p>Building HTTPD I see these warnings:</p>
<div class="codehilite"><pre><span></span><span>In function 'StringSetToBuffer',</span>
<span>    inlined from 'StringSetToBuffer' at /home/eschnetter/Cactus/arrangements/CactusConnect/HTTPD/src/SString.c:268:1,</span>
<span>    inlined from 'StringSetToCString' at /home/eschnetter/Cactus/arrangements/CactusConnect/HTTPD/src/SString.c:226:10:</span>
<span>/home/eschnetter/Cactus/arrangements/CactusConnect/HTTPD/src/SString.c:273:7: warning: 'strncpy' output truncated before terminating nul copying as many bytes from a string as its length [-Wstringop-truncation]</span>
<span>  273 |       strncpy( s->chars, buf, len );</span>
<span>      |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~</span>
<span>/home/eschnetter/Cactus/arrangements/CactusConnect/HTTPD/src/SString.c: In function 'StringSetToCString':</span>
<span>/home/eschnetter/Cactus/arrangements/CactusConnect/HTTPD/src/SString.c:226:10: note: length computed here</span>
<span>  226 |   return StringSetToBuffer( s, c_string, strlen( c_string ) );</span>
<span>      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~</span>
</pre></div>


<p>and</p>
<div class="codehilite"><pre><span></span><span>In function 'String_Copy',</span>
<span>    inlined from 'StringInsert' at /home/eschnetter/Cactus/arrangements/CactusConnect/HTTPD/src/SString.c:396:26:</span>
<span>/home/eschnetter/Cactus/arrangements/CactusConnect/HTTPD/src/SString.c:125:3: warning: 'memcpy' offset [0, 2] is out of the bounds [0, 0] [-Warray-bounds=]</span>
<span>  125 |   memcpy( s->line_end, other->line_end, LINE_END_BUFSIZE</span>
<span>      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~</span>
<span>  126 |           * sizeof( SSCHAR ) );</span>
<span>      |           ~~~~~~~~~~~~~~~~~~~~</span>
</pre></div>


<p>These look serious.</p>
<p>--<br/>
Ticket URL: <a href='https://bitbucket.org/einsteintoolkit/tickets/issues/2750/httpd-array-access-out-of-bounds'>https://bitbucket.org/einsteintoolkit/tickets/issues/2750/httpd-array-access-out-of-bounds</a></p>
</html>