LOG_QUOTE_QUOTES fmt code problem

From: Tsantilas Christos <chtsanti_at_users.sourceforge.net>
Date: Thu, 30 Aug 2012 13:15:55 +0300

Playing with valgrind I found the following problem.
Inside Format::Format::assemble method, there is the following code:

   out = tmp;
   ....
   if (out && *out) {
     ...
     newout = tmp;
     log_quoted_string(out, newout);
     ...
   }

The out and newout variables point to the same buffer (tmp). Also the
log_quoted_string function internally considers that the two buffers are
different and must not point to the same buffer.

The code currently works, but it is not correct, and in the future we
may have problems.

I am attaching a patch for this problem but we may want different
solution, eg using a tmp2 static buffer, or modify and document the
log_quoted_string function to take as argument only one parameter.

Received on Thu Aug 30 2012 - 10:16:10 MDT

This archive was generated by hypermail 2.2.0 : Thu Aug 30 2012 - 12:00:12 MDT