Skip to content
Snippets Groups Projects
Commit 80833e28 authored by Henrik (Grubba) Grubbström's avatar Henrik (Grubba) Grubbström
Browse files

Master: Fix issue where describe_string() could lengthen the output.

Fixes edge-case where the string to be formatted (m) is shorter than
the maxlen, but the formatted string (t) is longer. This caused the
truncation code to instead lengthen the string...

Fixes [PIKE-224].
parent eba0233c
No related branches found
No related tags found
No related merge requests found
...@@ -60,7 +60,6 @@ testfont binary ...@@ -60,7 +60,6 @@ testfont binary
/lib/7.4/modules/SSL.pmod/constants.pike foreign_ident /lib/7.4/modules/SSL.pmod/constants.pike foreign_ident
/lib/7.4/modules/__default.pmod foreign_ident /lib/7.4/modules/__default.pmod foreign_ident
/lib/include/profiling.h foreign_ident /lib/include/profiling.h foreign_ident
/lib/master.pike.in foreign_ident
/lib/modules/ADT.pmod/History.pike foreign_ident /lib/modules/ADT.pmod/History.pike foreign_ident
/lib/modules/ADT.pmod/Queue.pike foreign_ident /lib/modules/ADT.pmod/Queue.pike foreign_ident
/lib/modules/ADT.pmod/Relation.pmod/Binary.pike foreign_ident /lib/modules/ADT.pmod/Relation.pmod/Binary.pike foreign_ident
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
// Pike is distributed under GPL, LGPL and MPL. See the file COPYING // Pike is distributed under GPL, LGPL and MPL. See the file COPYING
// for more information. // for more information.
// //
// $Id: master.pike.in,v 1.331 2004/01/12 23:37:07 nilsson Exp $ // $Id$
#pike __REAL_VERSION__ #pike __REAL_VERSION__
...@@ -2818,6 +2818,9 @@ class Describer ...@@ -2818,6 +2818,9 @@ class Describer
string t = sprintf("%O", m); string t = sprintf("%O", m);
if (sizeof(t) < (maxlen + 2)) if (sizeof(t) < (maxlen + 2))
return t; return t;
// NB: The code further below requires maxlen <= sizeof(m).
// We adjust maxlen so that this holds. Cf [PIKE-224].
maxlen = sizeof(m) - (sizeof(t) - maxlen);
t = 0; t = 0;
} }
clipped++; clipped++;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment