Browse code

Fix reading PString type in Photoshop thumbnails.

git-svn: trunk@1540

Trog authored on 2005/05/12 17:25:18
Showing 2 changed files
... ...
@@ -1,3 +1,7 @@
1
+Thu May 12 09:23:52 BST 2005 (trog)
2
+-----------------------------------
3
+  * libclamav/speical.c: Fix reading PString type in Photoshop thumbnails.
4
+
1 5
 Thu May 12 08:32:22 BST 2005 (njh)
2 6
 ----------------------------------
3 7
   * clamav-milter:	Open /dev/console (if LogFile not set) before
... ...
@@ -93,7 +93,8 @@ int cli_check_mydoom_log(int desc, const char **virname)
93 93
 static int jpeg_check_photoshop_8bim(int fd)
94 94
 {
95 95
 	unsigned char bim[5];
96
-	uint16_t id, nlength;
96
+	uint16_t id, ntmp;
97
+	uint8_t nlength;
97 98
 	uint32_t size;
98 99
 	off_t offset;
99 100
 	int retval;
... ...
@@ -114,15 +115,12 @@ static int jpeg_check_photoshop_8bim(int fd)
114 114
 	}
115 115
 	id = special_endian_convert_16(id);
116 116
 	cli_dbgmsg("ID: 0x%.4x\n", id);
117
-	if (cli_readn(fd, &nlength, 2) != 2) {
117
+	if (cli_readn(fd, &nlength, 1) != 1) {
118 118
 		return -1;
119 119
 	}
120
-	nlength = special_endian_convert_16(nlength);
121
-	/* Seek past the name string */
122
-	if (nlength > 0) {
123
-		lseek(fd, nlength, SEEK_CUR);
124
-	}
125
-
120
+	ntmp = nlength + ((((uint16_t)nlength)+1) & 0x01);
121
+	lseek(fd, ntmp, SEEK_CUR);
122
+	
126 123
 	if (cli_readn(fd, &size, 4) != 4) {
127 124
 		return -1;
128 125
 	}