<p>Harald Welte has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/10434">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">layer23: Fix compiler warnings about string operation truncation<br><br>This fixes the below warnings:<br><br>gsm322.c: In function ‘gsm322_cs_ba_range’:<br>gsm322.c:3480:3: warning: ‘strncpy’ specified bound 10 equals destination size [-Wstringop-truncation]<br>   strncpy(lower_text,  gsm_print_arfcn(index2arfcn(lower)),  ARFCN_TEXT_LEN);<br>   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br>gsm322.c:3480:3: warning: ‘strncpy’ specified bound 10 equals destination size [-Wstringop-truncation]<br>gsm322.c:3480:3: warning: ‘strncpy’ specified bound 10 equals destination size [-Wstringop-truncation]<br>gsm322.c:3480:3: warning: ‘strncpy’ specified bound 10 equals destination size [-Wstringop-truncation]<br>gsm322.c:3481:3: warning: ‘strncpy’ specified bound 10 equals destination size [-Wstringop-truncation]<br>   strncpy(higher_text, gsm_print_arfcn(index2arfcn(higher)), ARFCN_TEXT_LEN);<br>   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br>gsm322.c: In function ‘gsm322_cs_powerscan’:<br>gsm322.c:2862:2: warning: ‘strncpy’ specified bound 10 equals destination size [-Wstringop-truncation]<br>  strncpy(s_text, gsm_print_arfcn(index2arfcn(s)), ARFCN_TEXT_LEN);<br>  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br>gsm322.c:2863:2: warning: ‘strncpy’ specified bound 10 equals destination size [-Wstringop-truncation]<br>  strncpy(e_text, gsm_print_arfcn(index2arfcn(e)), ARFCN_TEXT_LEN);<br>  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br><br>Change-Id: I08f938cfb2589574e90d5831a00c0140f71d5bfe<br>---<br>M src/host/layer23/src/mobile/gsm322.c<br>1 file changed, 4 insertions(+), 4 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/34/10434/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/src/host/layer23/src/mobile/gsm322.c b/src/host/layer23/src/mobile/gsm322.c</span><br><span>index 21cf8f3..f23c796 100644</span><br><span>--- a/src/host/layer23/src/mobile/gsm322.c</span><br><span>+++ b/src/host/layer23/src/mobile/gsm322.c</span><br><span>@@ -2859,8 +2859,8 @@</span><br><span>          }</span><br><span>    }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-   strncpy(s_text, gsm_print_arfcn(index2arfcn(s)), ARFCN_TEXT_LEN);</span><br><span style="color: hsl(0, 100%, 40%);">-       strncpy(e_text, gsm_print_arfcn(index2arfcn(e)), ARFCN_TEXT_LEN);</span><br><span style="color: hsl(120, 100%, 40%);">+     osmo_strlcpy(s_text, gsm_print_arfcn(index2arfcn(s)), ARFCN_TEXT_LEN);</span><br><span style="color: hsl(120, 100%, 40%);">+        osmo_strlcpy(e_text, gsm_print_arfcn(index2arfcn(e)), ARFCN_TEXT_LEN);</span><br><span>       LOGP(DCS, LOGL_DEBUG, "Scanning frequencies. (%s..%s)\n",</span><br><span>          s_text,</span><br><span>              e_text);</span><br><span>@@ -3477,8 +3477,8 @@</span><br><span>                     higher += 1024-512;</span><br><span>          }</span><br><span>            range++;</span><br><span style="color: hsl(0, 100%, 40%);">-                strncpy(lower_text,  gsm_print_arfcn(index2arfcn(lower)),  ARFCN_TEXT_LEN);</span><br><span style="color: hsl(0, 100%, 40%);">-             strncpy(higher_text, gsm_print_arfcn(index2arfcn(higher)), ARFCN_TEXT_LEN);</span><br><span style="color: hsl(120, 100%, 40%);">+           osmo_strlcpy(lower_text,  gsm_print_arfcn(index2arfcn(lower)),  ARFCN_TEXT_LEN);</span><br><span style="color: hsl(120, 100%, 40%);">+              osmo_strlcpy(higher_text, gsm_print_arfcn(index2arfcn(higher)), ARFCN_TEXT_LEN);</span><br><span>             LOGP(DCS, LOGL_INFO, "Use BA range: %s..%s\n",</span><br><span>                     lower_text,</span><br><span>                  higher_text);</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/10434">change 10434</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/10434"/><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: I08f938cfb2589574e90d5831a00c0140f71d5bfe </div>
<div style="display:none"> Gerrit-Change-Number: 10434 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Harald Welte <laforge@gnumonks.org> </div>