From: <ha...@us...> - 2009-07-09 15:12:38
|
Revision: 2000 http://ganglia.svn.sourceforge.net/ganglia/?rev=2000&view=rev Author: hawson Date: 2009-07-09 15:12:35 +0000 (Thu, 09 Jul 2009) Log Message: ----------- Force null termination in string metrics. Thanks to Greg Bruno for the patch. Modified Paths: -------------- trunk/monitor-core/gmond/modules/python/mod_python.c Modified: trunk/monitor-core/gmond/modules/python/mod_python.c =================================================================== --- trunk/monitor-core/gmond/modules/python/mod_python.c 2009-06-14 16:39:45 UTC (rev 1999) +++ trunk/monitor-core/gmond/modules/python/mod_python.c 2009-07-09 15:12:35 UTC (rev 2000) @@ -128,6 +128,10 @@ else if (PyString_Check(dv)) { char* p = PyString_AsString(dv); strncpy(bfr, p, len); + /* + * ensure bfr is null terminated + */ + bfr[len-1] = '\0'; } else if (PyFloat_Check(dv)) { double v = PyFloat_AsDouble(dv); @@ -423,7 +427,7 @@ gmi->tmax = minfo->tmax; if (!strcasecmp(minfo->vtype, "string")) { gmi->type = GANGLIA_VALUE_STRING; - gmi->msg_size = UDP_HEADER_SIZE+32; + gmi->msg_size = UDP_HEADER_SIZE+MAX_G_STRING_SIZE; } else if (!strcasecmp(minfo->vtype, "uint")) { gmi->type = GANGLIA_VALUE_UNSIGNED_INT; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |