I'm used to being paranoid due to Microsoft's goofy _snprintf implementation where it doesnt enforce nul termination when the formatted string is greater than the size of the buffer which is kinda the whole point. I'll back the -1 out today.
Kirby On Sun, 25 Jul 2004 11:05:24 +0200, Peter Kjellerstedt <[EMAIL PROTECTED]> wrote: > > -----Original Message----- > > From: [EMAIL PROTECTED] > > [mailto:[EMAIL PROTECTED] On > > Behalf Of [EMAIL PROTECTED] > > Sent: Sunday, July 25, 2004 06:03 > > To: [EMAIL PROTECTED] > > Subject: E CVS: libs/etox vacuum > > > > Enlightenment CVS committal > > > > Author : vacuum > > Project : e17 > > Module : libs/etox > > > > Dir : e17/libs/etox/src/style > > > > > > Modified Files: > > etox_style_style.c > > > > > > Log Message: > > sprintf->snprintf > > > > =================================================================== > > RCS file: > > /cvsroot/enlightenment/e17/libs/etox/src/style/etox_style_style.c,v > > retrieving revision 1.2 > > retrieving revision 1.3 > > diff -u -3 -r1.2 -r1.3 > > --- etox_style_style.c 11 Jun 2004 14:19:05 -0000 1.2 > > +++ etox_style_style.c 25 Jul 2004 04:03:00 -0000 1.3 > > @@ -733,36 +733,36 @@ > > layer = (Etox_Style_Style_Layer > *)calloc(sizeof(Etox_Style_Style_Layer), > > 1); > > > > - sprintf(key, "/layers/%d/stack", i); > > + snprintf(key, sizeof(key)-1, "/layers/%d/stack", i); > > e_db_int_get(info->style_db, key, &layer->stack); > > > > - sprintf(key, "/layers/%d/size_change", i); > > + snprintf(key, sizeof(key)-1, "/layers/%d/size_change", > i); > > e_db_int_get(info->style_db, key, &layer->size_change); > > [snip] > > Why 'sizeof(key)-1'? Why not 'sizeof key'? > The size argument to snprintf() should include the space > needed for the terminating NUL character. > > //Peter > > ------------------------------------------------------- > This SF.Net email is sponsored by BEA Weblogic Workshop > FREE Java Enterprise J2EE developer tools! > Get your free copy of BEA WebLogic Workshop 8.1 today. > http://ads.osdn.com/?ad_idG21&alloc_id040&op=click > _______________________________________________ > enlightenment-devel mailing list > [EMAIL PROTECTED] > https://lists.sourceforge.net/lists/listinfo/enlightenment-devel > -- PGP Fingerprint: 8784 EAFE E9C5 D083 3E81 727C F265 5AEF E6F8 A671 ------------------------------------------------------- This SF.Net email is sponsored by OSTG. Have you noticed the changes on Linux.com, ITManagersJournal and NewsForge in the past few weeks? Now, one more big change to announce. We are now OSTG- Open Source Technology Group. Come see the changes on the new OSTG site. www.ostg.com _______________________________________________ enlightenment-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/enlightenment-devel