[Midnightbsd-cvs] src [12075] trunk/lib/libmport/pkgmeta.c: check columns

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Sun Sep 23 11:21:54 EDT 2018


Revision: 12075
          http://svnweb.midnightbsd.org/src/?rev=12075
Author:   laffer1
Date:     2018-09-23 11:21:53 -0400 (Sun, 23 Sep 2018)
Log Message:
-----------
check columns

Modified Paths:
--------------
    trunk/lib/libmport/pkgmeta.c

Modified: trunk/lib/libmport/pkgmeta.c
===================================================================
--- trunk/lib/libmport/pkgmeta.c	2018-09-22 22:07:35 UTC (rev 12074)
+++ trunk/lib/libmport/pkgmeta.c	2018-09-23 15:21:53 UTC (rev 12075)
@@ -492,9 +492,19 @@
 			RETURN_ERROR(MPORT_ERR_FATAL, "Out of memory.");
 	}
 
-	pack->expiration_date = sqlite3_column_int64(stmt, 10);
+	if (sqlite3_column_type(stmt, 10) == SQLITE_INTEGER) {
+		pack->expiration_date = sqlite3_column_int64(stmt, 10);
+	} else {
+		pack->expiration_date = 0;
+		RETURN_ERROR(MPORT_ERR_FATAL, "expiration_date is null?");
+	}
 
-	pack->no_provide_shlib =  sqlite3_column_int(stmt, 11);
+	if (sqlite3_column_type(stmt, 10) == SQLITE_INTEGER) {
+		pack->no_provide_shlib =  sqlite3_column_int(stmt, 11);
+	} else {
+		pack->no_provide_shlib = 0;
+		RETURN_ERROR(MPORT_ERR_FATAL, "no_provide_shlib is null?");
+	}
 
 	/* flavor */
 	if ((tmp = sqlite3_column_text(stmt, 12)) == NULL) {



More information about the Midnightbsd-cvs mailing list