<p> Attention is currently required from: Benjamin Keith Ford. </p>
<p>Patch set 3:<span style="border-radius: 3px; display: inline-block; margin: 0 2px; padding: 4px;background-color: #ffd4d4; color: #000000;">Code-Review -1</span></p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/16497">View Change</a></p><p>6 comments:</p><ul style="list-style: none; padding: 0;"><li style="margin: 0; padding: 0;"><p><a href="null">File include/asterisk/res_stir_shaken.h:</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.asterisk.org/c/asterisk/+/16497/comment/05904bd7_8678e614">Patch Set #3, Line 94:</a> <code style="font-family:monospace,monospace">int ast_stir_shaken_verify(const char *header, const char *payload, const char *signature, const char *algorithm,</code></p><p style="white-space: pre-wrap; word-wrap: break-word;">The altered function definition breaks ABI</p></li></ul></li><li style="margin: 0; padding: 0;"><p><a href="null">File res/res_pjsip_session.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.asterisk.org/c/asterisk/+/16497/comment/a28e0dcb_1e261ab2">Patch Set #3, Line 4070:</a> <code style="font-family:monospace,monospace">ast_sip_rdata_get_header_value</code></p><p style="white-space: pre-wrap; word-wrap: break-word;">I was curious what this function returned. It returns a pointer to the underlying pjsip "string" data. However pjsip strings are not null terminated, and not sure if they are even initialized to NULL/empty.</p><p style="white-space: pre-wrap; word-wrap: break-word;">This could potentially reference some random place in memory and cause unexpected results. Also, anyone place that calls this function and attempts to dereference the pointer will either cause a crash, or at the very least point to a non-NULL terminated string.</p><p style="white-space: pre-wrap; word-wrap: break-word;">So I believe the the 'ast_sip_rdata_get_header_value' function needs "fixing".</p></li></ul></li><li style="margin: 0; padding: 0;"><p><a href="null">File res/res_pjsip_stir_shaken.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.asterisk.org/c/asterisk/+/16497/comment/78729996_bb405b98">Patch Set #3, Line 126:</a> <code style="font-family:monospace,monospace">        char timezone[80];</code></p><p style="white-space: pre-wrap; word-wrap: break-word;">Initialize this to NULL just in case, i.e. timezone[80] = {0}.</p><p style="white-space: pre-wrap; word-wrap: break-word;">If sscanf fails to fill it below then a subsequent reference to it could result in indeterminate a value.</p></li><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.asterisk.org/c/asterisk/+/16497/comment/b0031bd4_59d04ee8">Patch Set #3, Line 129:</a> <code style="font-family:monospace,monospace"> date_hdr_val = ast_sip_rdata_get_header_value(rdata, date_hdr_str);</code></p><p style="white-space: pre-wrap; word-wrap: break-word;">The return value of 'ast_sip_rdata_get_header_value' needs to be fixed somehow.</p><p style="white-space: pre-wrap; word-wrap: break-word;">'ast_sip_rdata_get_header_value' returns a non-null terminated string, and potentially an unitialized pointer. Any use/reference to data_hdr_val below could cause unexpected behavior.</p></li><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.asterisk.org/c/asterisk/+/16497/comment/71e3daec_cf7d7caa">Patch Set #3, Line 140:</a> <code style="font-family:monospace,monospace"> sscanf(remainder, "%79s", timezone);</code></p><p style="white-space: pre-wrap; word-wrap: break-word;">Is remainder always guaranteed to be the expected timezone?</p><p style="white-space: pre-wrap; word-wrap: break-word;">strptime returns a pointer to the first character not processed, or NULL. You catch the NULL case above, but could remainder be an empty string, or some other value besides timezone?</p><p style="white-space: pre-wrap; word-wrap: break-word;">At the very least I'd say you want to check the return value of sscanf to ensure the item was filled.</p></li><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.asterisk.org/c/asterisk/+/16497/comment/e17c597d_4be1a432">Patch Set #3, Line 199:</a> </p><p><blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;"><pre style="font-family: monospace,monospace; white-space: pre-wrap;">  RAII_VAR(struct ast_json *, json, NULL, ast_json_unref);<br>      RAII_VAR(char *, combined_str, NULL, ast_free);<br></pre></blockquote></p><p style="white-space: pre-wrap; word-wrap: break-word;">Maybe I am missing something, but these to variables appear to be unused. If that's the case they can be removed.</p></li></ul></li></ul><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/16497">change 16497</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.asterisk.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.asterisk.org/c/asterisk/+/16497"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 16 </div>
<div style="display:none"> Gerrit-Change-Id: I4ac1ecf652cd0e336006b0ca638dc826b5b1ebf7 </div>
<div style="display:none"> Gerrit-Change-Number: 16497 </div>
<div style="display:none"> Gerrit-PatchSet: 3 </div>
<div style="display:none"> Gerrit-Owner: Benjamin Keith Ford <bford@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Friendly Automation </div>
<div style="display:none"> Gerrit-Reviewer: Kevin Harwell <kharwell@digium.com> </div>
<div style="display:none"> Gerrit-Attention: Benjamin Keith Ford <bford@digium.com> </div>
<div style="display:none"> Gerrit-Comment-Date: Wed, 22 Sep 2021 20:00:48 +0000 </div>
<div style="display:none"> Gerrit-HasComments: Yes </div>
<div style="display:none"> Gerrit-Has-Labels: Yes </div>
<div style="display:none"> Gerrit-MessageType: comment </div>