>>> On 9/24/2008 at 11:44 PM, in message <[EMAIL PROTECTED]>, <[EMAIL PROTECTED]> wrote: > Revision: 1825 > http://ganglia.svn.sourceforge.net/ganglia/?rev=1825&view=rev > Author: carenas > Date: 2008-09-25 05:44:07 +0000 (Thu, 25 Sep 2008) > > Log Message: > ----------- > gmond: replace sprintf call with equivalent snprintf call > > reverted in r1030 by unrelated change > > Modified Paths: > -------------- > trunk/monitor-core/gmond/gmond.c > > Modified: trunk/monitor-core/gmond/gmond.c > =================================================================== > --- trunk/monitor-core/gmond/gmond.c 2008-09-25 05:28:37 UTC (rev 1824) > +++ trunk/monitor-core/gmond/gmond.c 2008-09-25 05:44:07 UTC (rev 1825) > @@ -2386,7 +2386,11 @@ > { > if (strcasecmp(cb->name, metric_info[i].name) == 0) > { > - sprintf (modular_desc, "%s (module %s)", > metric_info[i].desc, cb->modp->module_name); > + snprintf (modular_desc, sizeof(modular_desc), > + "%s (module %s)", > + metric_info[i].desc, > + cb->modp->module_name); > + > desc = (char*)modular_desc; > break; > } > >
When copying into the buffer, shouldn't the length be sizeof(modular_desc)-1 rather than the full length of the buffer? It needs to allow for a NULL terminator. Brad ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Ganglia-developers mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ganglia-developers
