Browse code

add support for SL+n

git-svn-id: file:///var/lib/svn/clamav-devel/trunk/clamav-devel@1417 77e5149b-7576-45b1-b177-96237e5ba77b

Tomasz Kojm authored on 2005/03/22 08:27:33
Showing 2 changed files
... ...
@@ -1,3 +1,8 @@
1
+Tue Mar 22 00:23:43 CET 2005 (tk)
2
+---------------------------------
3
+  * libclamav/matcher.c: add support for SL+n (last section + offset); requested
4
+			 by Christoph Cordes <ccordes*clamav.net>
5
+
1 6
 Mon Mar 21 02:24:33 CET 2005 (tk)
2 7
 ---------------------------------
3 8
   * freshclam: add LocalIPAddress/--local-address (patch by Thomas Lamy)
... ...
@@ -130,17 +130,33 @@ static long int cli_caloff(const char *offstr, int fd)
130 130
 	}
131 131
 	lseek(fd, n, SEEK_SET);
132 132
 
133
-	if(sscanf(offstr, "S%d+%ld", &n, &offset) != 2)
134
-	    return -1;
133
+	if(!strncmp(offstr, "SL", 2)) {
135 134
 
136
-	if(n >= peinfo.nsections) {
137
-	    free(peinfo.section);
138
-	    return -1;
135
+	    if(sscanf(offstr, "SL+%ld", &offset) != 1) {
136
+		free(peinfo.section);
137
+		return -1;
138
+	    }
139
+
140
+	    offset += peinfo.section[peinfo.nsections - 1].raw;
141
+
142
+	} else {
143
+
144
+	    if(sscanf(offstr, "S%d+%ld", &n, &offset) != 2) {
145
+		free(peinfo.section);
146
+		return -1;
147
+	    }
148
+
149
+	    if(n >= peinfo.nsections) {
150
+		free(peinfo.section);
151
+		return -1;
152
+	    }
153
+
154
+	    offset += peinfo.section[n].raw;
139 155
 	}
140 156
 
141
-	offset += peinfo.section[n].raw;
142 157
 	free(peinfo.section);
143 158
 	return offset;
159
+
144 160
     } else if(!strncmp(offstr, "EOF-", 4)) {
145 161
 	    struct stat sb;
146 162