<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html lang="en">
<head>
<meta content="text/html; charset=US-ASCII" http-equiv="Content-Type">
<title>
GitLab
</title>


<style>img {
max-width: 100%; height: auto;
}
</style>
</head>
<body>
<div class="content">

<p class="details" style="font-style: italic; color: #666;">
<a href="https://gitlab.com/adelapie">Antonio de la Piedra</a> created an issue <a href="https://gitlab.com/gnutls/gnutls/-/issues/1076">#1076</a>:
</p>
<div></div>
<p dir="auto">Hello,</p>
<p dir="auto">I found two places in GnuTLS were sizeof() is used on a pointer:</p>
<ol dir="auto">
<li>lib/accelerated/x86/x86-common.c, line 315</li>
</ol>
<pre class="code highlight js-syntax-highlight plaintext" lang="plaintext" v-pre="true"><code><span id="LC1" class="line" lang="plaintext">static int check_phe_partial(void)</span>
<span id="LC2" class="line" lang="plaintext">{</span>
<span id="LC3" class="line" lang="plaintext">       const char *text = "test and test";</span>
<span id="LC4" class="line" lang="plaintext">       uint32_t iv[5] = { 0x67452301UL, 0xEFCDAB89UL,</span>
<span id="LC5" class="line" lang="plaintext">               0x98BADCFEUL, 0x10325476UL, 0xC3D2E1F0UL</span>
<span id="LC6" class="line" lang="plaintext">       };</span>
<span id="LC7" class="line" lang="plaintext"></span>
<span id="LC8" class="line" lang="plaintext">       padlock_sha1_blocks(iv, text, sizeof(text) - 1);</span>
<span id="LC9" class="line" lang="plaintext">       padlock_sha1_blocks(iv, text, sizeof(text) - 1);</span>
<span id="LC10" class="line" lang="plaintext"></span>
<span id="LC11" class="line" lang="plaintext">      if (iv[0] == 0x9096E2D8UL && iv[1] == 0xA33074EEUL &&</span>
<span id="LC12" class="line" lang="plaintext">          iv[2] == 0xCDBEE447UL && iv[3] == 0xEC7979D2UL &&</span>
<span id="LC13" class="line" lang="plaintext">          iv[4] == 0x9D3FF5CFUL)</span>
<span id="LC14" class="line" lang="plaintext">              return 1;</span>
<span id="LC15" class="line" lang="plaintext">      else</span>
<span id="LC16" class="line" lang="plaintext">              return 0;</span>
<span id="LC17" class="line" lang="plaintext">}</span>
<span id="LC18" class="line" lang="plaintext"></span></code></pre>
<p dir="auto">The sizeof of the pointer text is taken in padlock_sha1_blocks (it is always 7).</p>
<ol start="2" dir="auto">
<li>tests/suite/mini-record-timing.c, line 235</li>
</ol>
<pre class="code highlight js-syntax-highlight plaintext" lang="plaintext" v-pre="true"><code><span id="LC1" class="line" lang="plaintext">               ret = gnutls_record_send(session, text, sizeof(text));</span>
<span id="LC2" class="line" lang="plaintext"></span>
<span id="LC3" class="line" lang="plaintext"></span></code></pre>
<p dir="auto">where text is a pointer.</p>
<p dir="auto">Best regards,
Antonio</p>

</div>
<div class="footer" style="margin-top: 10px;">
<p style="font-size: small; color: #666;">

<br>
Reply to this email directly or <a href="https://gitlab.com/gnutls/gnutls/-/issues/1076">view it on GitLab</a>.
<br>
You're receiving this email because of your account on gitlab.com.
If you'd like to receive fewer emails, you can
<a href="https://gitlab.com/-/sent_notifications/5a87ccb38166bee75be0e4f4d1f1de4d/unsubscribe">unsubscribe</a>
from this thread or
adjust your notification settings.
<script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","action":{"@type":"ViewAction","name":"View Issue","url":"https://gitlab.com/gnutls/gnutls/-/issues/1076"}}</script>


</p>
</div>
</body>
</html>