Skip to content

Commit

Permalink
Merge SVN 3994
Browse files Browse the repository at this point in the history
  • Loading branch information
ddeclerck committed Jun 12, 2024
1 parent a8a2f6a commit c194165
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion cobc/scanner.l
Original file line number Diff line number Diff line change
Expand Up @@ -1364,7 +1364,7 @@ read_literal (const char mark, const char *type)
) {
snprintf (err_msg, COB_MINI_MAX,
_("missing terminating %c character"), mark);
plex_buff[cb_lit_length - 0] = 0; /* ensure valid C-string for error message */
plex_buff[plex_size - 1] = 0; /* ensure valid C-string for error message */
error_literal ("", plex_buff);
}

Expand Down
1 change: 1 addition & 0 deletions libcob/ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -1291,6 +1291,7 @@

* common.c (cob_check_version): restored compat option for GC 2.x pre 2.2
* fileio.c, screenio.c, strings.c, termio.c: fixed some minor coding issues
* termio.c (cob_dump_field): fixed bad memcpy

2020-11-27 Simon Sobisch <simonsobisch@gnu.org>

Expand Down
10 changes: 10 additions & 0 deletions libcob/fileio.c
Original file line number Diff line number Diff line change
Expand Up @@ -1630,6 +1630,7 @@ do_acu_hypen_translation (char *src)
for (src = src + 3; *src && isspace ((cob_u8_t)*src); src++);

strncpy (file_open_buff, src, (size_t)COB_FILE_MAX);
file_open_buff[COB_FILE_MAX] = 0;
strncpy (file_open_name, file_open_buff, (size_t)COB_FILE_MAX);
}

Expand Down Expand Up @@ -1799,6 +1800,7 @@ cob_chk_file_mapping (cob_file *f, char *filename)
strncpy (file_open_buff, p, (size_t)COB_FILE_MAX);
}
}
file_open_buff[COB_FILE_MAX] = 0;
/* First element completed, loop through remaining */
/* elements delimited by slash */
/* Check only for $ from now on; includes the DD_xx/dd_xx/xx mapping */
Expand Down Expand Up @@ -7827,6 +7829,7 @@ open_cbl_file (cob_u8_ptr file_name, int file_access,
}

strncpy (file_open_name, fn, (size_t)COB_FILE_MAX);
file_open_name[COB_FILE_MAX] = 0;
cob_free (fn);
cob_chk_file_mapping (NULL, NULL);

Expand Down Expand Up @@ -8002,6 +8005,7 @@ cob_sys_delete_file (unsigned char *file_name)
}

strncpy (file_open_name, fn, (size_t)COB_FILE_MAX);
file_open_name[COB_FILE_MAX] = 0;
cob_free (fn);
cob_chk_file_mapping (NULL, NULL);

Expand Down Expand Up @@ -8040,6 +8044,7 @@ cob_sys_copy_file (unsigned char *fname1, unsigned char *fname2)
}

strncpy (file_open_name, fn1, (size_t)COB_FILE_MAX);
file_open_name[COB_FILE_MAX] = 0;
cob_free (fn1);
cob_chk_file_mapping (NULL, NULL);

Expand All @@ -8051,6 +8056,7 @@ cob_sys_copy_file (unsigned char *fname1, unsigned char *fname2)
}

strncpy (file_open_name, fn2, (size_t)COB_FILE_MAX);
file_open_name[COB_FILE_MAX] = 0;
cob_free (fn2);
cob_chk_file_mapping (NULL, NULL);

Expand Down Expand Up @@ -8105,6 +8111,7 @@ cob_sys_check_file_exist (unsigned char *file_name, unsigned char *file_info)
}

strncpy (file_open_name, fn, (size_t)COB_FILE_MAX);
file_open_name[COB_FILE_MAX] = 0;
cob_free (fn);
cob_chk_file_mapping (NULL, NULL);

Expand Down Expand Up @@ -8166,12 +8173,15 @@ cob_sys_rename_file (unsigned char *fname1, unsigned char *fname2)
}

strncpy (file_open_name, fn1, (size_t)COB_FILE_MAX);
file_open_name[COB_FILE_MAX] = 0;
cob_free (fn1);
cob_chk_file_mapping (NULL, NULL);

strncpy (localbuff, file_open_name, (size_t)COB_FILE_MAX);
localbuff[COB_FILE_MAX] = 0;

strncpy (file_open_name, fn2, (size_t)COB_FILE_MAX);
file_open_name[COB_FILE_MAX] = 0;
cob_free (fn2);
cob_chk_file_mapping (NULL, NULL);

Expand Down

0 comments on commit c194165

Please sign in to comment.