Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
Fix out-of-bound logic.
jlaffaye committed 15 years ago
commit dff127f3268c74698b615501754803171a66ecbf
parent 68c928a
1 file changed +2 -4
modified libpkg/pkgdb.c
@@ -47,10 +47,8 @@ pkgdb_regex(sqlite3_context *ctx, int argc, sqlite3_value **argv, int reg_type)
	regex_t *re;
	int ret;

-
	regex = sqlite3_value_text(argv[0]);
-
	str = sqlite3_value_text(argv[1]);
-

-
	if (argc != 2 || str == NULL || regex == NULL) {
+
	if (argc != 2 || (regex = sqlite3_value_text(argv[0])) == NULL ||
+
		(str = sqlite3_value_text(argv[1])) == NULL) {
		sqlite3_result_error(ctx, "SQL function regex() called with invalid arguments.\n", -1);
		return;
	}