Hi,

Quoting Herbert Thoma <herbert.th...@iis.fraunhofer.de>:

Hi!

[snip]
cc1: warnings being treated as errors
gnc-ui-util.c: In function ‘gnc_account_get_full_name’:
gnc-ui-util.c:760: error: array subscript is above array bounds

The following patch fixes this problem:

Index: src/app-utils/gnc-ui-util.c
===================================================================
--- src/app-utils/gnc-ui-util.c (Revision 18298)
+++ src/app-utils/gnc-ui-util.c (Arbeitskopie)
@@ -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';

Thank you for this patch.  Yes, this is definitely a bug.  However,
there is no need to change the strncpy, only the NUL setting.

  return result;
}

Herbert

-derek

--
      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

Reply via email to