Bug Fix - UUID corruption on Solaris 8

- Fixed a bug with an unterminated buffer in uuid() (thanks to
  Steven de Brouwer).
- Added Solaris 8 as another supported platform (thanks to Steven
  de Brouwer).
This commit is contained in:
Paul Beckingham 2009-05-12 23:18:32 -04:00
parent f9035eec70
commit 95f07cf363
4 changed files with 8 additions and 1 deletions

View file

@ -15,6 +15,7 @@ Contributing Authors:
David J Patrick David J Patrick
P.C. Shyamshankar P.C. Shyamshankar
Johan Friis Johan Friis
Steven de Brouwer
With thanks to: With thanks to:
Eugene Kramer Eugene Kramer

1
NEWS
View file

@ -12,6 +12,7 @@ Task has been built and tested on the following configurations:
- Ubuntu 8.10 Intrepid Ibex - Ubuntu 8.10 Intrepid Ibex
- Ubuntu 9.04 Jaunty Jackalope - Ubuntu 9.04 Jaunty Jackalope
- Arch Linux - Arch Linux
- Solaris 8
- Solaris 10 - Solaris 10
- Cygwin 1.5.25-14 - Cygwin 1.5.25-14

View file

@ -194,6 +194,7 @@
<li>Ubuntu 8.10 Intrepid Ibex <li>Ubuntu 8.10 Intrepid Ibex
<li>Ubuntu 9.04 Jaunty Jackalope <li>Ubuntu 9.04 Jaunty Jackalope
<li>Arch Linux <li>Arch Linux
<li>Solaris 8
<li>Solaris 10 <li>Solaris 10
<li>Cygwin 1.5.25-14 <li>Cygwin 1.5.25-14
</ul> </ul>

View file

@ -208,9 +208,12 @@ const std::string uuid ()
{ {
uuid_t id; uuid_t id;
uuid_generate (id); uuid_generate (id);
char buffer[100]; char buffer[100] = {0};
uuid_unparse_lower (id, buffer); uuid_unparse_lower (id, buffer);
// Bug found by Steven de Brouwer.
buffer[36] = '\0';
return std::string (buffer); return std::string (buffer);
} }
@ -271,6 +274,7 @@ const std::string uuid ()
id[33] = randomHexDigit (); id[33] = randomHexDigit ();
id[34] = randomHexDigit (); id[34] = randomHexDigit ();
id[35] = randomHexDigit (); id[35] = randomHexDigit ();
id[36] = '\0';
return id; return id;
} }