summaryrefslogtreecommitdiff
blob: 2e760088825294060598d8bfd2dd1b9cf9e83309 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
--- wav.c.old	2002-12-31 04:19:22.000000000 +0100
+++ wav.c	2004-07-18 19:25:46.000000000 +0200
@@ -917,6 +917,10 @@
 		} else if(strncmp(magic,"ICRD",4) == 0){
 			st_readdw(ft,&len); 
 			len = (len + 1) & ~1;
+			if (len > 254) {
+			    fprintf(stderr, "Possible buffer overflow hack attack (ICRD)!\n");
+			    exit(109);
+			}
 			st_reads(ft,text,len);
 			if (strlen(ft->comment) + strlen(text) < 254)
 			{
@@ -926,6 +930,10 @@
 		} else if(strncmp(magic,"ISFT",4) == 0){
 			st_readdw(ft,&len); 
 			len = (len + 1) & ~1;
+			if (len > 254) {
+			    fprintf(stderr, "Possible buffer overflow hack attack (ISFT)!\n");
+			    exit(110);
+			}
 			st_reads(ft,text,len);
 			if (strlen(ft->comment) + strlen(text) < 254)
 			{