[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
string ports hork on NUL's
From: |
Dale P. Smith |
Subject: |
string ports hork on NUL's |
Date: |
Wed, 11 Jul 2001 12:31:47 -0400 |
I was using a string port with guile-gd and the generated images were
always invalid. The strncpy in st_write.c was stopping at the first NUL
(as strncpy is supposed to do). Using memcpy seems to work nicely.
Patch is below.
Are string ports supposed to limited like this?
Index: strports.c
===================================================================
RCS file: /cvs/guile/guile-core/libguile/strports.c,v
retrieving revision 1.83
diff -u -r1.83 strports.c
--- strports.c 2001/07/01 11:57:56 1.83
+++ strports.c 2001/07/11 16:25:29
@@ -157,7 +157,7 @@
int space = pt->write_end - pt->write_pos;
int write_len = (size > space) ? space : size;
- strncpy ((char *) pt->write_pos, input, write_len);
+ memcpy (pt->write_pos, input, write_len);
pt->write_pos += write_len;
size -= write_len;
input += write_len;
-Dale
--
Dale P. Smith
Treasurer, Cleveland Linux Users Group http://cleveland.lug.net
Senior Systems Consultant, Altus Technologies Corporation
address@hidden
440-746-9000 x309
- string ports hork on NUL's,
Dale P. Smith <=