From e76b9e2d60b52d5628615865242f5ef681a96fe9 Mon Sep 17 00:00:00 2001 From: Tushar Jain <150601689+tushar3q34@users.noreply.github.com> Date: Fri, 21 Feb 2025 20:40:05 +0530 Subject: [PATCH] librz/analysis: prefix analysis fix `memmove()` call (#4918) --- librz/core/canalysis.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/librz/core/canalysis.c b/librz/core/canalysis.c index 80e4f8642a..b71c25abe6 100644 --- a/librz/core/canalysis.c +++ b/librz/core/canalysis.c @@ -5208,8 +5208,12 @@ static void *AnalysisBytesContext_next(RzIterator *it) { *sp = 0; if (op->prefix) { char *p = strchr(sp + 1, ' '); - *p = 0; - memmove(ctx->mnemonic, sp + 1, p - sp); + if (!p) { + rz_str_ncpy(ctx->mnemonic, sp + 1, strlen(sp + 1) + 1); + } else { + *p = 0; + rz_str_ncpy(ctx->mnemonic, sp + 1, p - sp); + } } } op->mnemonic = mnem;