[Pvfs2-cvs] commit by dbonnie in pvfs2/src/io/description: pint-distribution.c

CVS commit program cvs at parl.clemson.edu
Wed Jun 4 10:43:00 EDT 2008


Update of /anoncvs/pvfs2/src/io/description
In directory parlweb1:/tmp/cvs-serv1409/src/io/description

Modified Files:
      Tag: cu-security-branch
	pint-distribution.c 
Log Message:
Merge from HEAD


Index: pint-distribution.c
===================================================================
RCS file: /anoncvs/pvfs2/src/io/description/pint-distribution.c,v
diff -p -u -r1.23 -r1.23.20.1
--- pint-distribution.c	17 Sep 2006 19:11:13 -0000	1.23
+++ pint-distribution.c	4 Jun 2008 14:43:00 -0000	1.23.20.1
@@ -7,6 +7,7 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
+#include <assert.h>
 
 #define __PINT_REQPROTO_ENCODE_FUNCS_C
 #include "pvfs2-types.h"
@@ -95,8 +96,13 @@ PINT_dist *PINT_dist_create(const char *
 	      = (char *) new_dist + roundup8(sizeof(*new_dist));
 	    new_dist->params
 	      = (void *)(new_dist->dist_name + roundup8(new_dist->name_size));
+            /* after lookup there must be enough room to hold name */
+            assert(old_dist.name_size >= (strlen(old_dist.dist_name) + 1));
+            /* copy using length of string passed in by caller
+             * rather than rounded up name_size used for distribution packing
+             */
 	    memcpy(new_dist->dist_name, old_dist.dist_name,
-	      old_dist.name_size);
+	      (strlen(old_dist.dist_name) + 1));
 	    memcpy(new_dist->params, old_dist.params, old_dist.param_size);
 	    /* leave methods pointing to same static functions */
 	}



More information about the Pvfs2-cvs mailing list