In gsm411_sms.c the function gsm411_rx_rl_data receives "struct gsm48_hdr *gh" as input then in very first line typecasts the pointer to "struct gsm411_rp_hdr *rp_data" to access its "data" field.<div>
<br></div><div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><font face="courier new, monospace">struct gsm411_rp_hdr *rp_data = (struct gsm411_rp_hdr*)&gh->data;</font></blockquote>
</div><div><br></div><div>But the two header structures have their "data" fields offset by one byte as in:</div><div><br></div><div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<font face="courier new, monospace">struct gsm411_rp_hdr {<br><span class="Apple-tab-span" style="white-space:pre">     </span>uint8_t len;<br><span class="Apple-tab-span" style="white-space:pre">      </span>uint8_t msg_type;<br>
<span class="Apple-tab-span" style="white-space:pre"> </span>uint8_t msg_ref;<br><span class="Apple-tab-span" style="white-space:pre">  </span>uint8_t data[0];<br>} __attribute__ ((packed));<br></font></blockquote><div> </div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><font face="courier new, monospace">struct gsm48_hdr {<br>
<span class="Apple-tab-span" style="white-space:pre"> </span>uint8_t proto_discr;<br><span class="Apple-tab-span" style="white-space:pre">      </span>uint8_t msg_type;<br><span class="Apple-tab-span" style="white-space:pre"> </span>uint8_t data[0];<br>
} __attribute__((packed));</font></blockquote></div><div><br></div><div><br></div><div>Obviously this displacement has been compensated for elsewhere in the code as the application works. But this seems to be inadvertent. And if it is deliberate, it is risky programming practice and could create problems later on.</div>
<div><br></div><div>Request you to correct and update suitably.</div><div><br></div><div>Thanks.</div><div><br></div><div>B.</div><div><br></div>