Compile error

Herbert Thoma herbert.thoma at iis.fraunhofer.de
Mon Sep 7 07:34:40 EDT 2009


Hi!

gcc -DHAVE_CONFIG_H -I. -I../.. -DG_LOG_DOMAIN=\"gnc.app-utils\" -I../../lib/libc -I../../src -I../../src -I../../src/gnc-module -I../../src/calculation -I../../src/core-utils -I../../src/engine -I../../src/libqof/qof -pthread -pthread -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -DORBIT2=1 -pthread -I/usr/include/gconf/2 -I/usr/include/orbit-2.0 -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/gtk-2.0 -I/usr/lib64/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/freetype2 -I/usr/include/libpng12 -Werror -Wdeclaration-after-statement -Wno-pointer-sign -D_FORTIFY_SOURCE=2 -g -O2 -Wall -Wunused -Wmissing-prototypes -Wmissing-declarations -Wno-unused -MT gnc-ui-util.lo -MD -MP -MF .deps/gnc-ui-util.Tpo -c gnc-ui-util.c  -fPIC -DPIC -o .libs/gnc-ui-util.o
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';

   return result;
 }

 Herbert
-- 
Herbert Thoma
Dipl.-Ing., MBA
Head of Video Group
Multimedia Realtime Systems Department
Fraunhofer IIS
Am Wolfsmantel 33, 91058 Erlangen, Germany
Phone: +49-9131-776-6130
Fax:   +49-9131-776-6099
email: tma at iis.fhg.de
www: http://www.iis.fhg.de/


More information about the gnucash-devel mailing list