EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  <20112012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  <20112012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: Bug on alh (alarm handler) 1.2.26 alConfig.c file
From: Andrew Johnson <[email protected]>
To: [email protected]
Date: Wed, 29 Jun 2011 10:38:18 -0500
Hi Juan Carlos,

On 2011-06-28 [email protected] wrote:
> When defining a PV name longer than 32 characters in $FORCEPV statement in
>  the alarm configuration file, the PV name actually gets truncated (alh
>  1.2.26 version). After digging a little bit in the alh code, I noticed
>  that in alConfig.c line 494:
> 
> rtn = sscanf(buf,"%20s%32s%6s%lf%9s",command,name,mask,&dbl,string);
> 
> the PV name (name variable) is limited to 32 characters. I think it should
>  be either %s or limited to 64 characters.

I agree with you that the length limit is wrong, but this isn't the only place 
where the limit of 32 is used.  There are similar issues with $HEARTBEATPV, 
$SEVRPV and $ACKPV; they probably should all be using %*s with a length 
argument of PVNAME_SIZE.

There may be a few off-by-one errors here too, although they don't seem 
severe: PVNAME_SIZE derives from PVNAME_STRINGSZ which already allows for the 
string terminator (however the other component of it FLDNAME_SZ is wrong, 
field names haven't been limited to 4 characters for many years).  The 
alCreateChannel() code in alLib.c adds 1 to PVNAME_SIZE when calling calloc() 
but GetOptionalLine() in alConfig.c only allows for PVNAME_SIZE characters in 
the char name[] array so the calloc() +1 is unnecessary.  There are various 
other places in the code where PVNAME_SIZE is used when creating widgets, but 
I don't know whether the XmNmaxLength widget property is supposed to include 
the terminator or not.

Janet is on vacation this week, but she should see this message when she gets 
back on Tuesday.

Thanks,

- Andrew
-- 
Optimization is the process of taking something that works and
replacing it with something that almost works, but costs less.
-- Roger Needham

References:
Bug on alh (alarm handler) 1.2.26 alConfig.c file Juan.Guzman

Navigate by Date:
Prev: Re: Record Alarm/ AsynPortDriver reem ateia
Next: Re: Mantis 339 "enum string tbl cache read ASYNC IO postponed fixed" bug still around? Andrew Johnson
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  <20112012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Bug on alh (alarm handler) 1.2.26 alConfig.c file Juan.Guzman
Next: problem with ip330-2-6 (A/D converter board) scanmode functionality to switch modes at runtime Jay Steele
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  <20112012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 18 Nov 2013 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·