Skip to content

Commit

Permalink
Fix segfault in built-in buf() macro
Browse files Browse the repository at this point in the history
  • Loading branch information
calc84maniac committed Jul 3, 2022
1 parent 221898b commit 5f0786d
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions pass_one.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -334,15 +334,16 @@ char *handle_opcode_or_macro (char *ptr) {
define_t *define;
#ifdef USE_BUILTIN_FCREATE
if (!strncasecmp (name_start, "buf", name_end - name_start) && *ptr == '(') {
char buf[256];
char buf[256];
int value;
cur_buf = read_expr(ptr, buf, _T(")"));
ptr++;
read_expr(&ptr, buf, _T(")"));
if (parse_num(buf, &value)) {
cur_buf = value;
} else {
SetLastSPASMError(SPASM_ERR_INVALID_OPERANDS);
}
ptr += 2;
ptr++;
} else if (!strncasecmp (name_start, "clr", name_end - name_start) && *ptr == '(') {
expand_buf_t *eb_fcreate = fcreate_bufs[cur_buf];
if (eb_fcreate != NULL) {
Expand Down

0 comments on commit 5f0786d

Please sign in to comment.