libgda r3110 - in branches/release-3-0-branch: . providers/postgres



Author: murrayc
Date: Fri Apr  4 14:48:56 2008
New Revision: 3110
URL: http://svn.gnome.org/viewvc/libgda?rev=3110&view=rev

Log:
2008-04-04  Murray Cumming  <murrayc murrayc com>

* providers/postgres/utils.c (gda_postgres_type_oid_to_gda):
Prevent an access outside of an array, as found by valgrind.

Modified:
   branches/release-3-0-branch/ChangeLog
   branches/release-3-0-branch/providers/postgres/utils.c

Modified: branches/release-3-0-branch/providers/postgres/utils.c
==============================================================================
--- branches/release-3-0-branch/providers/postgres/utils.c	(original)
+++ branches/release-3-0-branch/providers/postgres/utils.c	Fri Apr  4 14:48:56 2008
@@ -121,6 +121,14 @@
 		if (type_data[i].oid == postgres_type) 
 			break;
 
+	/* Avoid accessing position -1: */
+	if(ntypes == 0)
+		return G_TYPE_STRING;
+
+	/* Avoid accesing beyone the array: */ 
+	if(i >= ntypes)
+		i = ntypes -1;
+       
   	if (type_data[i].oid != postgres_type)
 		return G_TYPE_STRING;
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]