Skip to content

Commit

Permalink
Fix string buffer over-read
Browse files Browse the repository at this point in the history
  • Loading branch information
fuhsnn committed Nov 27, 2024
1 parent 76d26f1 commit 7b08c7b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions codegen.c
Original file line number Diff line number Diff line change
Expand Up @@ -3187,7 +3187,7 @@ static void asm_constraint(AsmParam *ap, int x87_clobber) {
ap->flag = strdup(&p[4]);
continue;
}
for (; *p != '\0'; p++) {
for (; *p; p++) {
switch (*p) {
case '=':
case '+': continue;
Expand Down Expand Up @@ -3224,7 +3224,9 @@ static void asm_constraint(AsmParam *ap, int x87_clobber) {
case 'u': fixed_reg(&reg, REG_X87_ST1, tok); continue;
}
if (Isdigit(*p)) {
match_idx = strtoul(p, &p, 10);
char *pos;
match_idx = strtoul(p, &pos, 10);
p = pos - 1;
continue;
}
error_tok(ap->constraint, "unknown constraint \"%c\"", *p);
Expand Down

0 comments on commit 7b08c7b

Please sign in to comment.