Skip to content

Commit

Permalink
Merge SVN 4057
Browse files Browse the repository at this point in the history
  • Loading branch information
ddeclerck committed Jun 12, 2024
1 parent 86d7109 commit 6d60308
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
7 changes: 7 additions & 0 deletions cobc/ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -956,6 +956,13 @@
* codegen.c (output_dump_code): emit code for BASED/LINKAGE fields
to catch SIGSEGV/SIGBUS/SIGFPE and then skip the dump of that record

2020-12-07 Simon Sobisch <[email protected]>

* codegen.c (output_display_fields): prevent bad integer promotion in
libcob (typeck within va_arg) by forcing the unsigned long type for
the varargs argument
* typeck.c (cb_build_generic_register): favor memcpy over strncpy

2020-12-06 Simon Sobisch <[email protected]>

* Makefile.am (cobc_LDADD): fixed ordering, in-tree libraries
Expand Down
7 changes: 4 additions & 3 deletions cobc/typeck.c
Original file line number Diff line number Diff line change
Expand Up @@ -1658,7 +1658,6 @@ cb_build_generic_register (const char *name, const char *external_definition,
{
cb_tree field_tree;
char definition[COB_MINI_BUFF];
char temp[COB_MINI_BUFF] = { 0 };
char *p, *r;
struct cb_field *field;
enum cb_usage usage;
Expand Down Expand Up @@ -1707,9 +1706,10 @@ cb_build_generic_register (const char *name, const char *external_definition,
if (strncmp (p, "DISPLAY", (size_t)7) == 0) {
memset (p, ' ', 7);
} else {
char temp[COB_MINI_BUFF];
r = p;
while (*r != 0 && *r != ' ') r++;
strncpy (temp, p, r - p);
memcpy (temp, p, r - p);
temp [r - p] = 0;
memset (p, ' ', r - p);
COB_UNUSED (temp); /* FIXME: parse actual USAGE from temp */
Expand All @@ -1731,10 +1731,11 @@ cb_build_generic_register (const char *name, const char *external_definition,
}
}
if (p) {
char temp[COB_MINI_BUFF];
while (*p == ' ') p++;
r = p;
while (*r != 0 && *r != ' ') r++;
strncpy (temp, p, r - p);
memcpy (temp, p, r - p);
temp [r - p] = 0;
memset (p, ' ', r - p);
picture = cb_build_picture (temp);
Expand Down
2 changes: 1 addition & 1 deletion libcob/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -571,7 +571,7 @@ static int set_config_val (char *value, int pos);
static char *get_config_val (char *value, int pos, char *orgvalue);

static void cob_dump_module (char *reason);
static char abort_reason[COB_MINI_BUFF] = { 0 };
static char abort_reason[COB_MINI_BUFF] = "";
static unsigned int dump_trace_started; /* ensures that we dump/stacktrace only once */
#define DUMP_TRACE_DONE_DUMP (1U << 0)
#define DUMP_TRACE_DONE_TRACE (1U << 1)
Expand Down

0 comments on commit 6d60308

Please sign in to comment.