From 2aaa161543f5c2c8768ce427ca686cd67d7cb01b Mon Sep 17 00:00:00 2001
From: Christophe Geuzaine <cgeuzaine@ulg.ac.be>
Date: Mon, 6 Aug 2001 12:26:26 +0000
Subject: [PATCH] fix string allooc bug in gl2ps

---
 Graphics/Scale.cpp | 4 ++--
 Graphics/gl2ps.cpp | 4 ++--
 Plugin/Skin.cpp    | 5 +++--
 doc/VERSIONS       | 5 +++--
 4 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/Graphics/Scale.cpp b/Graphics/Scale.cpp
index 2b684377ce..cc50f28a70 100644
--- a/Graphics/Scale.cpp
+++ b/Graphics/Scale.cpp
@@ -1,4 +1,4 @@
-// $Id: Scale.cpp,v 1.19 2001-05-03 00:09:42 geuzaine Exp $
+// $Id: Scale.cpp,v 1.20 2001-08-06 12:26:26 geuzaine Exp $
 
 #include "Gmsh.h"
 #include "GmshUI.h"
@@ -47,7 +47,7 @@ void draw_scale(Post_View *v, double xmin, double ymin, double *width, double he
   double    font_h, font_a, label_h;
   double    cs_xmin, cs_ymin, cs_h, cs_w, cs_bh;
   double    cv_xmin, cv_ymin, cv_h, cv_w, cv_bh;
-  char      label[128] ;
+  char      label[1024] ;
   double    Val, ValMin, ValMax;
 
   font_h  = CTX.gl_fontheight ;       /* hauteur totale de la fonte */
diff --git a/Graphics/gl2ps.cpp b/Graphics/gl2ps.cpp
index cdbdcda353..44332232cd 100644
--- a/Graphics/gl2ps.cpp
+++ b/Graphics/gl2ps.cpp
@@ -5,7 +5,7 @@
  * GL2PS, an OpenGL to Postscript Printing Library
  * Copyright (C) 1999-2001  Christophe Geuzaine 
  *
- * $Id: gl2ps.cpp,v 1.24 2001-06-28 15:16:09 geuzaine Exp $
+ * $Id: gl2ps.cpp,v 1.25 2001-08-06 12:26:26 geuzaine Exp $
  *
  * E-mail: Christophe.Geuzaine@AdValvas.be
  * URL: http://www.geuz.org/gl2ps/
@@ -1371,7 +1371,7 @@ GLvoid gl2psText(char *str, char *fontname, GLint fontsize){
   glGetFloatv(GL_CURRENT_RASTER_COLOR, prim->verts[0].rgba);
   prim->text = (GL2PSstring*)gl2psMalloc(sizeof(GL2PSstring));
   if((len = strlen(str))){
-    prim->text->str = (char*)gl2psMalloc(len*sizeof(char));
+    prim->text->str = (char*)gl2psMalloc((len+1)*sizeof(char));
     strcpy(prim->text->str, str);
   }
   else
diff --git a/Plugin/Skin.cpp b/Plugin/Skin.cpp
index 17a87228ae..32e2e2ec29 100644
--- a/Plugin/Skin.cpp
+++ b/Plugin/Skin.cpp
@@ -1,4 +1,4 @@
-// $Id: Skin.cpp,v 1.6 2001-08-06 11:13:25 geuzaine Exp $
+// $Id: Skin.cpp,v 1.7 2001-08-06 12:26:26 geuzaine Exp $
 
 #include "Plugin.h"
 #include "Skin.h"
@@ -145,7 +145,8 @@ Post_View *GMSH_SkinPlugin::execute (Post_View *v)
 
     Tree_Action(skin, addSTinView);
     Tree_Delete(skin);
-    char name[1024],filename[1024];
+
+    char name[1024], filename[1024];
     sprintf(name,"skin-%s",vv->Name);
     sprintf(filename,"skin-%s",vv->FileName);
     EndView(1, filename, name);
diff --git a/doc/VERSIONS b/doc/VERSIONS
index b6f31d1a67..7dc89c1fb4 100644
--- a/doc/VERSIONS
+++ b/doc/VERSIONS
@@ -1,9 +1,10 @@
-$Id: VERSIONS,v 1.50 2001-08-06 09:46:15 geuzaine Exp $
+$Id: VERSIONS,v 1.51 2001-08-06 12:26:26 geuzaine Exp $
 
 New in 1.23: Better display of displacement maps; boundary operator
 generalization; new explode option for post-processing views; enhanced
 link view behaviour (to update only the changed items); new default
-plugins: Skin, Transform, Smooth.
+plugins: Skin, Transform, Smooth; various other bug fixes, additions
+and clean-ups;
 
 New in 1.22: Fixed (yet another) bug for 2D mesh in the mean plane;
 fixed surface coherence bug in extruded meshes; new double logarithmic
-- 
GitLab