EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

2002  2003  2004  2005  2006  2007  2008  2009  <20102011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024  Index 2002  2003  2004  2005  2006  2007  2008  2009  <20102011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: Bug in macLib
From: Eric Norum <[email protected]>
To: "Mark Rivers" <[email protected]>
Cc: Core-Talk <[email protected]>
Date: Wed, 31 Mar 2010 08:36:48 -0700
I like this change a little better.  It leaves the buffer null-terminated if at all possible.
Mark, can you check this on the system that was causing problem and see if it fixes things?



diff -u macCore.c.orig macCore.c
--- macCore.c.orig	2010-03-31 08:31:20.000000000 -0700
+++ macCore.c	2010-03-31 08:33:51.000000000 -0700
@@ -697,6 +697,10 @@
         printf( "trans-> entry = %p, level = %d, maxlen = %u, discard = %s, "
         "rawval = %s\n", entry, level, (unsigned int)(valend - *value), discard ? "T" : "F", *rawval );
 
+    /* Don't write past end of buffer */
+    if (valend == *value) { entry->error = TRUE; return; }
+    if (--valend == *value) { *valend = '\0'; entry->error = TRUE; return; }
+
     /* initially not in quotes */
     quote = 0;


-- 
Eric Norum
[email protected]






Replies:
Re: Bug in macLib Ralph Lange
References:
Bug in macLib Mark Rivers
Re: Bug in macLib Andrew Johnson
Re: Bug in macLib Eric Norum
RE: Bug in macLib Mark Rivers

Navigate by Date:
Prev: Re: Bug in macLib Eric Norum
Next: Re: Bug in macLib Ralph Lange
Index: 2002  2003  2004  2005  2006  2007  2008  2009  <20102011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: RE: Bug in macLib Mark Rivers
Next: Re: Bug in macLib Ralph Lange
Index: 2002  2003  2004  2005  2006  2007  2008  2009  <20102011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 02 Feb 2012 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·