summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Gran <spk121@yahoo.com>2009-09-05 11:10:07 -0700
committerMichael Gran <spk121@yahoo.com>2009-09-05 11:10:07 -0700
commit060e305adcb5a80dba8bf137dc3d61151d1c0dff (patch)
tree41a60f40fa53c56f9f2eadc83e71525e57862772
parent8748ffeaa770ed47192f970ef5302a7c7aa7a935 (diff)
downloadguile-060e305adcb5a80dba8bf137dc3d61151d1c0dff.tar.gz
Avoid string buffer overrun in scm_scan_for_encoding
* libguile/read.c (scm_scan_for_encoding): possible overrun if coding declaration is at end of file
-rw-r--r--libguile/read.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/libguile/read.c b/libguile/read.c
index 269e96b21..07c8d7163 100644
--- a/libguile/read.c
+++ b/libguile/read.c
@@ -1446,6 +1446,7 @@ scm_scan_for_encoding (SCM port)
/* grab the next token */
i = 0;
while (pos + i - header <= SCM_ENCODING_SEARCH_SIZE
+ && pos + i - header < bytes_read
&& (isalnum((int) pos[i]) || pos[i] == '_' || pos[i] == '-'
|| pos[i] == '.'))
i++;