Skip to content

Commit

Permalink
Fixed a->codebuf not null terminated in vasm.c
Browse files Browse the repository at this point in the history
  • Loading branch information
cyanpencil committed Jul 22, 2018
1 parent 1eadef5 commit 061bd8d
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions libr/core/vasm.c
Expand Up @@ -40,9 +40,12 @@ static int readline_callback(void *_a, const char *str) {
r_cons_print ("\n\n");
}
if (a->acode) {
xlen = strlen (a->acode->buf_hex);
xlen = R_MIN (strlen (a->acode->buf_hex), R_VISUAL_ASM_BUFSIZE - 2);
strcpy (a->codebuf, a->blockbuf);
memcpy (a->codebuf, a->acode->buf_hex, R_MIN (xlen, R_VISUAL_ASM_BUFSIZE - 1));
memcpy (a->codebuf, a->acode->buf_hex, xlen);
if (xlen >= strlen (a->blockbuf)) {
a->codebuf[xlen] = '\0';
}
}
{
int rows = 0;
Expand Down

0 comments on commit 061bd8d

Please sign in to comment.