diff options
author | Xavier Roche <xroche@users.noreply.github.com> | 2012-05-07 14:08:20 +0000 |
---|---|---|
committer | Xavier Roche <xroche@users.noreply.github.com> | 2012-05-07 14:08:20 +0000 |
commit | 355775b74baa429f913044a24b5229baff244928 (patch) | |
tree | fa9ec1d1b51ff668e11d13626af31ae4e971ebf0 /src | |
parent | 71d7f2868a6580f4628e56b2c33fe0bbd939a0ec (diff) |
Check for bogus links (Vasiliy)
Diffstat (limited to 'src')
-rw-r--r-- | src/htsparse.c | 23 |
1 files changed, 23 insertions, 0 deletions
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]; |