<p>Harald Welte has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/10436">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">layer23: Fix possible buffer overflow writing NUL beyond end of string<br><br>settings.c: In function ‘gsm_random_imei’:<br>settings.c:188:26: warning: ‘sprintf’ may write a terminating nul past the end of the destination [-Wformat-overflow=]<br>  sprintf(rand + 8, "%07ld", random() % 10000000);<br>                          ^<br>settings.c:188:2: note: ‘sprintf’ output between 8 and 9 bytes into a destination of size 8<br>  sprintf(rand + 8, "%07ld", random() % 10000000);<br>  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br><br>Change-Id: Id949487111235cd4af5ff068f1dce2f4b0801480<br>---<br>M src/host/layer23/src/mobile/settings.c<br>1 file changed, 1 insertion(+), 1 deletion(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/36/10436/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/src/host/layer23/src/mobile/settings.c b/src/host/layer23/src/mobile/settings.c</span><br><span>index 11c7f7b..9783583 100644</span><br><span>--- a/src/host/layer23/src/mobile/settings.c</span><br><span>+++ b/src/host/layer23/src/mobile/settings.c</span><br><span>@@ -177,7 +177,7 @@</span><br><span> int gsm_random_imei(struct gsm_settings *set)</span><br><span> {</span><br><span>        int digits = set->imei_random;</span><br><span style="color: hsl(0, 100%, 40%);">-       char rand[16];</span><br><span style="color: hsl(120, 100%, 40%);">+        char rand[16+1];</span><br><span> </span><br><span>         if (digits <= 0)</span><br><span>          return 0;</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/10436">change 10436</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.osmocom.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.osmocom.org/10436"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: osmocom-bb </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: Id949487111235cd4af5ff068f1dce2f4b0801480 </div>
<div style="display:none"> Gerrit-Change-Number: 10436 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Harald Welte <laforge@gnumonks.org> </div>