diff options
author | jb <jb@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-05-26 21:15:22 +0000 |
---|---|---|
committer | jb <jb@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-05-26 21:15:22 +0000 |
commit | a9b0b7c8b9f8b62cb1fab2f4a12b4276ed75ba8c (patch) | |
tree | 284b051453fcf4ab80253b550ab8f310e5e3a4ec /libgfortran/io/transfer.c | |
parent | 71668ec3f6494cb773b907a9c52421e86428d073 (diff) | |
download | gcc-a9b0b7c8b9f8b62cb1fab2f4a12b4276ed75ba8c.tar.gz |
2007-05-27 Janne Blomqvist <jb@gcc.gnu.org>
* runtime/string.c (compare0): Use gfc_charlen_type instead of int.
(fstrlen): Likewise.
(find_option): Likewise.
(fstrcpy): Use gfc_charlen_type instead of int, return length.
(cf_strcpy): Likewise.
* libgfortran.h: Change string prototypes to use gfc_charlen_type.
* io/open.c (new_unit): Use snprintf if available.
* io/list_read.c (nml_touch_nodes): Use memcpy instead of strcpy/strcat.
(nml_read_obj): Likewise.
* io/transfer.c (st_set_nml_var): Likewise.
* io/write.c (output_float): Use snprintf if available.
(nml_write_obj) Use memcpy instead of strcpy/strcat.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@125100 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgfortran/io/transfer.c')
-rw-r--r-- | libgfortran/io/transfer.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/libgfortran/io/transfer.c b/libgfortran/io/transfer.c index 128b4c1be59..24bcc5e1a3e 100644 --- a/libgfortran/io/transfer.c +++ b/libgfortran/io/transfer.c @@ -2852,13 +2852,15 @@ st_set_nml_var (st_parameter_dt *dtp, void * var_addr, char * var_name, { namelist_info *t1 = NULL; namelist_info *nml; + size_t var_name_len = strlen (var_name); nml = (namelist_info*) get_mem (sizeof (namelist_info)); nml->mem_pos = var_addr; - nml->var_name = (char*) get_mem (strlen (var_name) + 1); - strcpy (nml->var_name, var_name); + nml->var_name = (char*) get_mem (var_name_len + 1); + memcpy (nml->var_name, var_name, var_name_len); + nml->var_name[var_name_len] = '\0'; nml->len = (int) len; nml->string_length = (index_type) string_length; |