[pan] Use an int instead of a char
- From: Petr Kovář <pmkovar src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pan] Use an int instead of a char
- Date: Sun, 29 Sep 2019 19:26:52 +0000 (UTC)
commit 7f59091d8f53592fca1a957627a5bbfa7f3842fa
Author: Jonathan Briggs <zlynx acm org>
Date: Tue Aug 20 16:34:01 2019 -0600
Use an int instead of a char
The C character IO functions use an int for most operations, so
the type should be int for fgetc.
And the variable 'c' is reused to store the strlen() result.
Using a char type for strlen resulted in negative values whenever
a header line was longer than 127 bytes.
Here is a sample header line that caused problems:
x-microsoft-antispam-message-info:
aybxZFQCLkTSg3dcgJ5/htFKWNjG+YSDDv+nSqJhvcMwb2hnzVKN1KQn0G0vxYRF7D1aWmkCcHUBLLWq/szFtrbKQ3BvDyr8nRMpr8jVkfWPpXt2np7eZDBBm4pU/TvGa+D8n+YUALZRs+9JliL3TzP8d2LRFDWhGKAQXl/FXwpzBq8mv+hxIiUYBHn0IxdJA1gJIxAZms1tqzec9XLV8sLrPDL0Hu2rHnGbCJLIphSC0abIOH1VTEEdzkbXhS8aSk6636GkCI1f2fN9PVNMj9uWzfIM1gSOeJyro6lQxREwwLMqnLGsf44OEKsqfCsh3yrOixdSBMWx09f3xJVgQBQOovwLCF7INvX6Oexzd8eA8YoHGp/01qVP4cPdd7W2TbxFlK8nMFmjuXdCyw/4If+dJu+uKpMQ2vh69jR7XWg=
After that, 'c' was negative and resulted in reads and writes into
unallocated memory and finally a segmentation fault.
uulib/uuscan.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/uulib/uuscan.c b/uulib/uuscan.c
index f66868f..0b1b3ce 100644
--- a/uulib/uuscan.c
+++ b/uulib/uuscan.c
@@ -202,7 +202,7 @@ ScanHeaderLine (FILE *datei, char *initial)
}
while (!feof (datei)) {
- char c = fgetc (datei);
+ int c = fgetc (datei);
if (feof (datei))
break;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]