[R] data.entry segfault

Peter Dalgaard BSA p.dalgaard at biostat.ku.dk
Fri Dec 13 15:53:02 CET 2002


Peter Dalgaard BSA <p.dalgaard at biostat.ku.dk> writes:


> 1243    static KeySym GetKey(DEEvent * event)
> 1244    {
> 1245        char text[1];
> 1246        KeySym iokey;
> 1247
> 1248        XLookupString(event, text, 10, &iokey, 0);
> 1249        return iokey;
> 1250    }
> 
> And the XLookupString call is the culprit. "10" is the buffer length,
> but "text" is declared to have length 1, and in practice has at least 2
> bytes since "text" is \0-terminated...
> 
> Switching to "char text[10];" looks like a likely fix.

Actually, replacing 10 with 1 also works.

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907




More information about the R-help mailing list