From 355775b74baa429f913044a24b5229baff244928 Mon Sep 17 00:00:00 2001 From: Xavier Roche Date: Mon, 7 May 2012 14:08:20 +0000 Subject: Check for bogus links (Vasiliy) --- src/htsparse.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'src/htsparse.c') diff --git a/src/htsparse.c b/src/htsparse.c index 35d1bb9..0b7a785 100644 --- a/src/htsparse.c +++ b/src/htsparse.c @@ -1409,6 +1409,29 @@ int htsparse(htsmoduleStruct* str, htsmoduleStructExtended* stre) { i++; } } + // Check for bogus links (Vasiliy) + if (a != NULL) { + const size_t size = c - a + 1; + int i; + int first = 1; + for(i = 0 ; i < size ; i++) { + // Suspicious (in code ?), abort. + if (a[i] == ',' || a[i] == ';') { + if (first) { + a = NULL; + break; + } + } + // Suspicious, abort. + else if (a[i] == '"' || a[i] == '\'' || a[i] != '\t' || a[i] != '\r' || a[i] != '\n') { + a = NULL; + break; + } + else if (a[i] != ' ') { + first = 0; + } + } + } if (a != NULL) { if ((opt->debug>1) && (opt->log!=NULL)) { char str[512]; -- cgit v1.2.3