Phil,
As I said on -devel, there is no need to change the strncpy length,
only the length in the NUL setting.. In the worst case scenario you
will over-write the last byte twice.
-derek
Quoting Phil Longstaff <plongst...@code.gnucash.org>:
Author: plongstaff
Date: 2009-09-07 10:16:20 -0400 (Mon, 07 Sep 2009)
New Revision: 18299
Trac: http://svn.gnucash.org/trac/changeset/18299
Modified:
gnucash/trunk/src/app-utils/gnc-ui-util.c
Log:
Fix index-out-of-range compilation error
Modified: gnucash/trunk/src/app-utils/gnc-ui-util.c
===================================================================
--- gnucash/trunk/src/app-utils/gnc-ui-util.c 2009-09-06 18:42:43 UTC
(rev 18298)
+++ gnucash/trunk/src/app-utils/gnc-ui-util.c 2009-09-07 14:16:20 UTC
(rev 18299)
@@ -756,8 +756,8 @@
if (!account) return NULL;
name = xaccAccountGetFullName (account);
- strncpy( result, name, sizeof(result)-1 );
- result[sizeof(result)] = '\0';
+ strncpy( result, name, sizeof(result)-2 );
+ result[sizeof(result)-1] = '\0';
return result;
}
_______________________________________________
gnucash-changes mailing list
gnucash-chan...@gnucash.org
https://lists.gnucash.org/mailman/listinfo/gnucash-changes
--
Derek Atkins, SB '93 MIT EE, SM '95 MIT Media Laboratory
Member, MIT Student Information Processing Board (SIPB)
URL: http://web.mit.edu/warlord/ PP-ASEL-IA N1NWH
warl...@mit.edu PGP key available
_______________________________________________
gnucash-devel mailing list
gnucash-devel@gnucash.org
https://lists.gnucash.org/mailman/listinfo/gnucash-devel