summaryrefslogtreecommitdiff
path: root/libguile
diff options
context:
space:
mode:
authorMartin Grabmüller <mgrabmue@cs.tu-berlin.de>2001-05-28 18:42:57 +0000
committerMartin Grabmüller <mgrabmue@cs.tu-berlin.de>2001-05-28 18:42:57 +0000
commit8d09eb04493a7a3e6ab57cd8d3c1ef7da917b41d (patch)
tree692815d25531422ea4bafc409d016acbc99d4cf3 /libguile
parent24ecf16c0c37098ea7747510d205f802ef3f37a1 (diff)
* symbols.c (scm_gensym): Fix buffer overrun (try `(gensym
(make-string 2000 #\!))' in an older version). Change strncpy to memcpy to allow embedded NUL characters in symbol prefix.
Diffstat (limited to 'libguile')
-rw-r--r--libguile/ChangeLog8
-rw-r--r--libguile/symbols.c4
2 files changed, 10 insertions, 2 deletions
diff --git a/libguile/ChangeLog b/libguile/ChangeLog
index 4c719f2ec..7f0469983 100644
--- a/libguile/ChangeLog
+++ b/libguile/ChangeLog
@@ -1,3 +1,11 @@
+2001-05-28 Martin Grabmueller <mgrabmue@cs.tu-berlin.de>
+
+ * symbols.c (scm_gensym): Fix buffer overrun (try `(gensym
+ (make-string 2000 #\!))' in an older version).
+
+ Change strncpy to memcpy to allow embedded NUL characters in
+ symbol prefix.
+
2001-05-28 Michael Livshin <mlivshin@bigfoot.com>
* hooks.c (scm_create_hook): deprecated.
diff --git a/libguile/symbols.c b/libguile/symbols.c
index 6a463f914..83cddc0da 100644
--- a/libguile/symbols.c
+++ b/libguile/symbols.c
@@ -247,8 +247,8 @@ SCM_DEFINE (scm_gensym, "gensym", 0, 1, 0,
SCM_VALIDATE_STRING (1, prefix);
len = SCM_STRING_LENGTH (prefix);
if (len > MAX_PREFIX_LENGTH)
- name = SCM_MUST_MALLOC (MAX_PREFIX_LENGTH + SCM_INTBUFLEN);
- strncpy (name, SCM_STRING_CHARS (prefix), len);
+ name = SCM_MUST_MALLOC (len + SCM_INTBUFLEN);
+ memcpy (name, SCM_STRING_CHARS (prefix), len);
}
{
int n_digits = scm_iint2str (gensym_counter++, 10, &name[len]);