From 95f07cf3631b9a3419a45f5bec789c2d0853edfa Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Tue, 12 May 2009 23:18:32 -0400 Subject: [PATCH] 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). --- AUTHORS | 1 + NEWS | 1 + html/task.html | 1 + src/util.cpp | 6 +++++- 4 files changed, 8 insertions(+), 1 deletion(-) diff --git a/AUTHORS b/AUTHORS index bb1cc3836..5dc52124c 100644 --- a/AUTHORS +++ b/AUTHORS @@ -15,6 +15,7 @@ Contributing Authors: David J Patrick P.C. Shyamshankar Johan Friis + Steven de Brouwer With thanks to: Eugene Kramer diff --git a/NEWS b/NEWS index 74adecd87..30d4f8f1e 100644 --- a/NEWS +++ b/NEWS @@ -12,6 +12,7 @@ Task has been built and tested on the following configurations: - Ubuntu 8.10 Intrepid Ibex - Ubuntu 9.04 Jaunty Jackalope - Arch Linux + - Solaris 8 - Solaris 10 - Cygwin 1.5.25-14 diff --git a/html/task.html b/html/task.html index 7f49fe428..54fb6fabe 100644 --- a/html/task.html +++ b/html/task.html @@ -194,6 +194,7 @@
  • Ubuntu 8.10 Intrepid Ibex
  • Ubuntu 9.04 Jaunty Jackalope
  • Arch Linux +
  • Solaris 8
  • Solaris 10
  • Cygwin 1.5.25-14 diff --git a/src/util.cpp b/src/util.cpp index 1fe260c89..21c4717ee 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -208,9 +208,12 @@ const std::string uuid () { uuid_t id; uuid_generate (id); - char buffer[100]; + char buffer[100] = {0}; uuid_unparse_lower (id, buffer); + // Bug found by Steven de Brouwer. + buffer[36] = '\0'; + return std::string (buffer); } @@ -271,6 +274,7 @@ const std::string uuid () id[33] = randomHexDigit (); id[34] = randomHexDigit (); id[35] = randomHexDigit (); + id[36] = '\0'; return id; }