<p dir="ltr"><br>
El 1/9/2015 23:10, "Joel Sherrill" <<a href="mailto:joel.sherrill@oarcorp.com">joel.sherrill@oarcorp.com</a>> escribió:<br>
><br>
><br>
><br>
> On September 1, 2015 8:33:54 PM CDT, Daniel Gutson <<a href="mailto:daniel.gutson@tallertechnologies.com">daniel.gutson@tallertechnologies.com</a>> wrote:<br>
> >Is there any reason to not declare these variables as unsigned (int)?<br>
> >IIUC strlen returns an unsigned integral. Sign-correctnesd doesn't hurt<br>
> >and I saw many bugs caused by the lack of it (the last one being pushed<br>
> >few says ago in the Chromium beowser).<br>
><br>
> I was wondering if they should be size_t when I looked at the code. I will check that and change it.<br>
><br>
> I was more concerned that none of the calls used the n version of the string or snprintf() method. I planned to fix that on the master. We probably need to make a rule to ban use of the non-n versions of the string methods.</p>
<p dir="ltr">I couldn't agree more.</p>
<p dir="ltr">><br>
><br>
><br>
> >El 1/9/2015 18:41, "Joel Sherrill" <<a href="mailto:joel.sherrill@oarcorp.com">joel.sherrill@oarcorp.com</a>><br>
> >escribió:<br>
> ><br>
> >Updates #2405.<br>
> >---<br>
> > cpukit/libmisc/dumpbuf/dumpbuf.c | 6 ++++--<br>
> > 1 file changed, 4 insertions(+), 2 deletions(-)<br>
> ><br>
> >diff --git a/cpukit/libmisc/dumpbuf/dumpbuf.c<br>
> >b/cpukit/libmisc/dumpbuf/dumpbuf.c<br>
> >index 9d34d42..36a8656 100644<br>
> >--- a/cpukit/libmisc/dumpbuf/dumpbuf.c<br>
> >+++ b/cpukit/libmisc/dumpbuf/dumpbuf.c<br>
> >@@ -62,18 +62,20 @@ static inline void Dump_Line(<br>
> ><br>
> >   int  i;<br>
> >   char line_buffer[120];<br>
> >+  int  len;<br>
> ><br>
> >   line_buffer[0] = '\0';<br>
> ><br>
> >   for( i=0 ; i<length ; i++ )<br>
> >-    sprintf( line_buffer, "%s%02x ", line_buffer, buffer[ i ] );<br>
> >+    sprintf( &line_buffer[i*3], "%02x ", buffer[ i ] );<br>
> ><br>
> >   for( ; i<16 ; i++ )<br>
> >     strcat( line_buffer, "   " );<br>
> ><br>
> >   strcat( line_buffer, "|" );<br>
> >+  len = strlen( line_buffer );<br>
> >   for( i=0 ; i<length ; i++ )<br>
> >-    sprintf( line_buffer, "%s%c", line_buffer,<br>
> >+    sprintf( &line_buffer[len+i], "%c",<br>
> >              isprint( buffer[ i ] ) ? buffer[ i ] : '.' );<br>
> ><br>
> >   for( ; i<16 ; i++ )<br>
> >--<br>
> >1.8.3.1<br>
> ><br>
> >_______________________________________________<br>
> >devel mailing list<br>
> ><a href="mailto:devel@rtems.org">devel@rtems.org</a><br>
> ><a href="http://lists.rtems.org/mailman/listinfo/devel">http://lists.rtems.org/mailman/listinfo/devel</a><br>
><br>
> --joel<br>
</p>