Open Source Telephony
 help / color / mirror / Atom feed
From: Denis Kenzior <denkenz@gmail.com>
To: ofono@ofono.org
Subject: Re: [PATCH 1/3] Fix CTLV three-byte tag parsing.
Date: Thu, 22 Apr 2010 16:58:20 -0500	[thread overview]
Message-ID: <201004221658.20759.denkenz@gmail.com> (raw)
In-Reply-To: <1271923876-3320-1-git-send-email-andrew.zaborowski@intel.com>

[-- Attachment #1: Type: text/plain, Size: 1804 bytes --]

Hi Andrew,

> ---
>  src/simutil.c |   12 ++++++------
>  1 files changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/src/simutil.c b/src/simutil.c
> index 9fb111f..822938c 100644
> --- a/src/simutil.c
> +++ b/src/simutil.c
> @@ -210,7 +210,7 @@ void comprehension_tlv_iter_init(struct
>  comprehension_tlv_iter *iter, iter->data = 0;
>  }
> 
> -/* Comprehension TLVs defined in Section 7 of ETSI TS 102.220 */
> +/* Comprehension TLVs defined in Section 7 of ETSI TS 101.220 */
>  gboolean comprehension_tlv_iter_next(struct comprehension_tlv_iter *iter)
>  {
>  	const unsigned char *pdu = iter->pdu + iter->pos;
> @@ -230,18 +230,18 @@ gboolean comprehension_tlv_iter_next(struct
>  comprehension_tlv_iter *iter) return FALSE;
> 
>  	/*
> -	 * ETSI TS 102.220, Section 7.1.1.2
> +	 * ETSI TS 101.220, Section 7.1.1.2
>  	 *
>  	 * If byte 1 of the tag is equal to 0x7F, then the tag is encoded
> -	 * on the following two bytes, with bit 8 of the 2nd byte of the tag
> -	 * being the CR flag.
> +	 * on the following two bytes, with bit 8 of the 1st byte of the tag
> +	 * as the most significant bit.

Please keep the comment about the CR flag, I think that is useful. 

>  	 */
> -	if (tag == 0x7F) {
> +	if (tag == 0x7F && !cr) {

This isn't actually necessary.  However, the statement:

        if (tag == 0x00 || tag == 0xFF || tag == 0x80)
                return FALSE;

Actually needs to be moved up and tag changed to *pdu.

>  		if ((pdu + 2) > end)
>  			return FALSE;
> 
>  		cr = bit_field(pdu[0], 7, 1);
> -		tag = ((pdu[0] & 0x7f) << 7) | pdu[1];
> +		tag = ((pdu[0] & 0x7f) << 8) | pdu[1];
> 
>  		if (tag < 0x0001 || tag > 0x7fff)
>  			return FALSE;
> 

Can you resubmit the patch with these changes?

Thanks,
-Denis

  parent reply	other threads:[~2010-04-22 21:58 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-22  8:11 [PATCH 1/3] Fix CTLV three-byte tag parsing Andrzej Zaborowski
2010-04-22 21:17 ` andrzej zaborowski
2010-04-22 21:58 ` Denis Kenzior [this message]
2010-04-22  9:13   ` [PATCH] " Andrzej Zaborowski
2010-04-22 22:45     ` Denis Kenzior

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201004221658.20759.denkenz@gmail.com \
    --to=denkenz@gmail.com \
    --cc=ofono@ofono.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox