[Xcb] [PATCH:xcb-util] Make sure wm_class name strings are null-terminated

Alan Coopersmith alan.coopersmith at oracle.com
Tue Jun 15 07:34:57 PDT 2010


Arnaud Fontaine wrote:
> Hi,
> 
>     >> I  see ICCCM claims  WM_CLASS are always null-terminated,  when I
>     >> found they weren't always in practice.
> 
>     > After digging into this more,  I'm not sure if any patch is needed
>     > here.   It depends  on whether  you want to  expose bugs  in other
>     > people's code, or protect API callers from them.
> 
> IMO, a patch isn't  needed because I don't think this is  a good idea to
> make an heap allocation just to workaround buggy code. Maybe an assert()
> would be enough?

I don't think an assert is a good idea - my program shouldn't die because
someone else's had a bug, but I was considering submitting a patch that
checked the results were null terminated and if not, discarded them as an
error.   If I did that, should there be any diagnostic that this happened?
fprintf(stderr, ...) in the middle of a X library seems so ugly, despite
the huge amount of crap I get on stderr from most gtk applications.

-- 
	-Alan Coopersmith-        alan.coopersmith at oracle.com
	 Oracle Solaris Platform Engineering: X Window System



More information about the Xcb mailing list