[Debburn-devel] [PATCH] fixes for aliasing bugs

Lorenz Minder lminder at gmx.net
Wed Sep 27 23:45:43 UTC 2006


Hi,

Peter Samuelson wrote:
> [Lorenz Minder]
> >  		} else {
> > -			strcpy((char *)outp, a2h[*inp-192]);
> > -			outp += strlen(a2h[*inp-192]);
> > +			strcpy(outp, a2h[((unsigned char)*inp) - 192]);
> > +			outp += strlen(a2h[((unsigned char)*inp) -192]);
> >  		}
> 
> That's really hard to read.  May I suggest temporary variables?
> 
>  		} else {
> +			char *tmp = a2h[((unsigned)*inp) - 192];
> +			size_t tmpl = strlen(tmp);
> +			memcpy(outp, tmp, tmpl+1);
> +			outp += tmpl;
>  		}

Yes, thanks, I'm all for it.

Anyways, I have to reread this code more in depth.  I think I've spotted
some other, potentially serious problems in this code.  I hope I come
around doing more work on that this week-end.

Best,
--Lorenz



More information about the Debburn-devel mailing list