<p style="white-space: pre-wrap; word-wrap: break-word;">Thanks for reviewing. Looks like my idea with the extra buffer did not work out. The reason for this is that there are checks later in the code and those will fail. I need to check the returncode of each bitvec_get_uint(), which is not so nice. Unfortunately after release 4, they added new files with each release.</p><p><a href="https://gerrit.osmocom.org/c/libosmocore/+/21083">View Change</a></p><p>4 comments:</p><ul style="list-style: none; padding: 0;"><li style="margin: 0; padding: 0;"><p><a href="https://gerrit.osmocom.org/c/libosmocore/+/21083/1/src/gsm/gsm48_ie.c">File src/gsm/gsm48_ie.c:</a></p><ul style="list-style: none; padding: 0;"><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.osmocom.org/c/libosmocore/+/21083/1/src/gsm/gsm48_ie.c@1318">Patch Set #1, Line 1318:</a> <code style="font-family:monospace,monospace">classmark3_len > sizeof(data</code></p><p><blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;">How is this possible given that typeof(classmark3_len) is 'uint8_t' and thus the maximum is 255? […]</blockquote></p><p style="white-space: pre-wrap; word-wrap: break-word;">Done</p></li><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.osmocom.org/c/libosmocore/+/21083/1/src/gsm/gsm48_ie.c@1326">Patch Set #1, Line 1326:</a> <code style="font-family:monospace,monospace">     bv.data = (uint8_t*) data;</code></p><p><blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;">Without 'const' before the bitvec definition, since you're relying on the 'current_bit'.</blockquote></p><p style="white-space: pre-wrap; word-wrap: break-word;">(the reason has nothing to do with const)</p><p style="white-space: pre-wrap; word-wrap: break-word;">I copy classmark3 to a memory that is pre-initalized with zeros to get some buffer. This way I can ensure that even if the IE has ended, the parser can safely continue to parse the bitvector. Otherwise I might overrun the buffer. One could argue that I could count the parsed bits, or check the return codes - which I see now is necessary. My code wouln't work with release 5 for example.</p><p style="white-space: pre-wrap; word-wrap: break-word;">Classmark3 is very problematic when it comes to length. Througout the 3gpp releases there were multiple versions specified because they added more and more fields.</p></li></ul></li><li style="margin: 0; padding: 0;"><p><a href="https://gerrit.osmocom.org/c/libosmocore/+/21083/1/tests/gsm0408/gsm0408_test.c">File tests/gsm0408/gsm0408_test.c:</a></p><ul style="list-style: none; padding: 0;"><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.osmocom.org/c/libosmocore/+/21083/1/tests/gsm0408/gsm0408_test.c@330">Patch Set #1, Line 330:</a> <code style="font-family:monospace,monospace">void dump_cm3(struct gsm48_classmark3 *cm3)</code></p><p><blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;">static</blockquote></p><p style="white-space: pre-wrap; word-wrap: break-word;">Done</p></li><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.osmocom.org/c/libosmocore/+/21083/1/tests/gsm0408/gsm0408_test.c@507">Patch Set #1, Line 507:</a> <code style="font-family:monospace,monospace">uint8_t</code></p><p><blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;">const</blockquote></p><p style="white-space: pre-wrap; word-wrap: break-word;">Done</p></li></ul></li></ul><p>To view, visit <a href="https://gerrit.osmocom.org/c/libosmocore/+/21083">change 21083</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/c/libosmocore/+/21083"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: libosmocore </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: Ic8b2bfd00330235f5bed00771e421588abfaac1f </div>
<div style="display:none"> Gerrit-Change-Number: 21083 </div>
<div style="display:none"> Gerrit-PatchSet: 2 </div>
<div style="display:none"> Gerrit-Owner: dexter <pmaier@sysmocom.de> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins Builder </div>
<div style="display:none"> Gerrit-Reviewer: pespin <pespin@sysmocom.de> </div>
<div style="display:none"> Gerrit-CC: fixeria <vyanitskiy@sysmocom.de> </div>
<div style="display:none"> Gerrit-Comment-Date: Mon, 09 Nov 2020 17:44:36 +0000 </div>
<div style="display:none"> Gerrit-HasComments: Yes </div>
<div style="display:none"> Gerrit-Has-Labels: No </div>
<div style="display:none"> Comment-In-Reply-To: fixeria <vyanitskiy@sysmocom.de> </div>
<div style="display:none"> Comment-In-Reply-To: pespin <pespin@sysmocom.de> </div>
<div style="display:none"> Gerrit-MessageType: comment </div>