<p>Patch set 2:<span style="border-radius: 3px; display: inline-block; margin: 0 2px; padding: 4px;background-color: #d4ffd4; color: #000000;">Code-Review +1</span></p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/14447">View Change</a></p><p>2 comments:</p><ul style="list-style: none; padding: 0;"><li style="margin: 0; padding: 0;"><p><a href="https://gerrit.asterisk.org/c/asterisk/+/14447/2/res/res_pjsip_stir_shaken.c">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/+/14447/2/res/res_pjsip_stir_shaken.c@36">Patch Set #2, Line 36:</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;">/*!<br> * \brief Decode a base 64 encoded string<br> *<br> * \note This function just makes it easier to base64decode since it<br> * calculates the length for you<br> *<br> * \param s The encoded string<br> *<br> * \retval NULL on failure<br> * \retval decoded string on success<br> */<br>static char *decode_base64_string(const char *s)<br>{<br>  size_t encoded_len;<br>   size_t decoded_len;<br>   int padding = 0;<br>      unsigned char *decoded_string;<br><br>      if (ast_strlen_zero(s)) {<br>             return NULL;<br>  }<br><br>   encoded_len = strlen(s);<br>      if (encoded_len > 2 && s[encoded_len - 1] == '=') {<br>                padding++;<br>            if (s[encoded_len - 2] == '=') {<br>                      padding++;<br>            }<br>     }<br><br>   decoded_len = (encoded_len / 4 * 3) - padding;<br>        decoded_string = ast_calloc(1, decoded_len);<br>  if (!decoded_string) {<br>                return NULL;<br>  }<br><br>   ast_base64decode(decoded_string, s, decoded_len);<br><br>   return (char *)decoded_string;<br>}<br><br></pre></blockquote></p><p style="white-space: pre-wrap; word-wrap: break-word;">This could go in utils.c since it's generic. ast_base64decode_string or something like that.<br>No need to change unless you're making other changes to this review.</p></li><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.asterisk.org/c/asterisk/+/14447/2/res/res_pjsip_stir_shaken.c@158">Patch Set #2, Line 158:</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;">static char *get_value_from_header_inbound(pjsip_rx_data *rdata, const pj_str_t str)<br>{<br>      pjsip_generic_string_hdr *hdr;<br>        pj_str_t hdr_val;<br><br>   hdr = pjsip_msg_find_hdr_by_name(rdata->msg_info.msg,<br>              &str, NULL);<br>      if (!hdr) {<br>           return NULL;<br>  }<br><br>   pj_strdup_with_null(rdata->tp_info.pool, &hdr_val, &hdr->hvalue);<br><br>     return hdr_val.ptr;<br>}<br><br></pre></blockquote></p><p style="white-space: pre-wrap; word-wrap: break-word;">This would probably be a good utility function to put in res_pjsip.c...  "ast_sip_rdata_get_header_value"<br>No need to change unless you have to change something else.</p></li></ul></li></ul><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/14447">change 14447</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/+/14447"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: I855f857be3d1c63b64812ac35d9ce0534085b913 </div>
<div style="display:none"> Gerrit-Change-Number: 14447 </div>
<div style="display:none"> Gerrit-PatchSet: 2 </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: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-Comment-Date: Tue, 02 Jun 2020 16:00:02 +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>