[PATCH 1/3] stkutil: display text attributes as html

Kristen Carlson Accardi kristen at linux.intel.com
Thu Jul 1 11:29:03 PDT 2010


On Thu, 01 Jul 2010 11:30:07 -0500
Denis Kenzior <denkenz at gmail.com> wrote:

> 
> > +		start = attrs[i++];
> > +		len = attrs[i++];
> > +		code = attrs[i++];
> 
> You might want to be extra paranoid here that attrs_len is a multiple of 4.

attrs_len does not have to be a multiple of 4.  I will add a sanity
check to attrs_len to make sure it is at least >= i + 3.

> 
> > +
> > +		if (i < attrs_len)
> > +			color = attrs[i++];
> > +		else
> > +			color = 0;
> > +
> > +		if (len == 0)
> > +			end = text_len;
> > +		else
> > +			end = start + len;
> > +
> > +		/* sanity check values */
> > +		if (start > end || end > text_len)
> > +			continue;
> > +
> > +		/*
> > +		 * if the alignment is the same as either the default
> > +		 * or the last alignment used, don't set any alignment
> > +		 * value.
> > +		 */
> > +		if (start == 0)
> > +			align = STK_DEFAULT_TEXT_ALIGNMENT;
> 
> Are attributes which do not contain start = 0 valid?  If so, you might
> take extra care here.

Yes start can be nonzero, but I don't understand what you are asking here.
If start is not equal to zero, we have already made sure it is not
greater than the end.

Thanks,
Kristen


More information about the ofono mailing list