Browse code

handle EP-n offset specification

git-svn: trunk@1714

Tomasz Kojm authored on 2005/09/06 01:20:28
Showing 2 changed files
... ...
@@ -1,3 +1,8 @@
1
+Mon Sep  5 18:18:24 CEST 2005 (tk)
2
+----------------------------------
3
+  * libclamav/matcher.c: handle EP-n offset specification (requested by
4
+			 Arnaud Jacques)
5
+
1 6
 Thu Sep  1 22:04:00 BST 2005 (njh)
2 7
 ----------------------------------
3 8
   * libclamav/untar.c:	Added support for various GNU extensions: volume
... ...
@@ -105,7 +105,7 @@ static long int cli_caloff(const char *offstr, int fd)
105 105
 
106 106
     if(isdigit(offstr[0])) {
107 107
 	return atoi(offstr);
108
-    } if(!strncmp(offstr, "EP+", 3)) {
108
+    } if(!strncmp(offstr, "EP+", 3) || !strncmp(offstr, "EP-", 3)) {
109 109
 	if((n = lseek(fd, 0, SEEK_CUR)) == -1) {
110 110
 	    cli_dbgmsg("Invalid descriptor\n");
111 111
 	    return -1;
... ...
@@ -117,7 +117,12 @@ static long int cli_caloff(const char *offstr, int fd)
117 117
 	}
118 118
 	free(peinfo.section);
119 119
 	lseek(fd, n, SEEK_SET);
120
-	return peinfo.ep + atoi(offstr + 3);
120
+
121
+	if(offstr[2] == '+')
122
+	    return peinfo.ep + atoi(offstr + 3);
123
+	else
124
+	    return peinfo.ep - atoi(offstr + 3);
125
+
121 126
     } else if(offstr[0] == 'S') {
122 127
 	if((n = lseek(fd, 0, SEEK_CUR)) == -1) {
123 128
 	    cli_dbgmsg("Invalid descriptor\n");