From cdb004808272cd331f09334fff618a8976e4fb25 Mon Sep 17 00:00:00 2001 From: Justin Maggard Date: Tue, 16 Dec 2014 15:30:45 -0800 Subject: [PATCH] Fix invalid read on empty string queries. --- src/DAAP2SQL.g | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/DAAP2SQL.g b/src/DAAP2SQL.g index 93e9a428..1fcbf12f 100644 --- a/src/DAAP2SQL.g +++ b/src/DAAP2SQL.g @@ -252,7 +252,7 @@ expr returns [ pANTLR3_STRING result, int valid ] val[0] = '\%'; } - if (val[strlen((char *)val) - 1] == '*') + if (val[0] && val[1] && val[strlen((char *)val) - 1] == '*') { op = '\%'; val[strlen((char *)val) - 1] = '\%';