diff --git a/nemu/src/monitor/sdb/watchpoint.c b/nemu/src/monitor/sdb/watchpoint.c index 688c39d..8bd7bfd 100644 --- a/nemu/src/monitor/sdb/watchpoint.c +++ b/nemu/src/monitor/sdb/watchpoint.c @@ -83,7 +83,7 @@ int wp_add(char * expr) { return 1; } strncpy(wp->expr, expr, len + 1); - wp->expr[len - 1] = '\0'; + wp->expr[len] = '\0'; return 0; }