public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] gentoo-x86 commit in dev-lang/gdl/files: 0.9.3-sstream.patch
@ 2013-01-02 21:44 Sebastien Fabbro (bicatali)
  0 siblings, 0 replies; only message in thread
From: Sebastien Fabbro (bicatali) @ 2013-01-02 21:44 UTC (permalink / raw
  To: gentoo-commits

bicatali    13/01/02 21:44:31

  Added:                0.9.3-sstream.patch
  Log:
  Version bump. Added a patch to overcome buffer overflows in integer to string conversions
  
  (Portage version: 2.2.01.21476-prefix/cvs/Linux x86_64, signed Manifest commit with key 0x13CB1360)

Revision  Changes    Path
1.1                  dev-lang/gdl/files/0.9.3-sstream.patch

file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-lang/gdl/files/0.9.3-sstream.patch?rev=1.1&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-lang/gdl/files/0.9.3-sstream.patch?rev=1.1&content-type=text/plain

Index: 0.9.3-sstream.patch
===================================================================
--- src/magick_cl.cpp.orig	2013-01-02 13:39:02.387184167 -0800
+++ src/magick_cl.cpp	2013-01-02 13:40:14.876543262 -0800
@@ -30,6 +30,7 @@
 #include <string>
 #include <fstream>
 #include <memory>
+#include <sstream>
 //#include <Magick++.h>
 
 #include "datatypes.hpp"
@@ -57,25 +58,17 @@
 
   string GDLutos(unsigned int i)
   {
-    int mema=3;
-    char *n=new char(mema);
-    while (snprintf(n, sizeof n, "%u", i) >= sizeof n)
-      {			delete n;mema++; n=new char(mema);   }
-    string s=n;
-    delete n;
-    return s;
+    istringstream s;
+    s >> i;
+    return s.str();
   }
 
   
   string GDLitos(int i)
   {
-    int mema=3;
-    char *n=new char(mema);
-    while (snprintf(n, sizeof n, "%d", i) >= sizeof n)
-      {			delete n;mema++; n=new char(mema);   }
-    string s=n;
-    delete n;
-    return s;
+    istringstream s;
+    s >> i;
+    return s.str();
   }
 
 





^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2013-01-02 21:44 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-02 21:44 [gentoo-commits] gentoo-x86 commit in dev-lang/gdl/files: 0.9.3-sstream.patch Sebastien Fabbro (bicatali)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox