diff options
Diffstat (limited to 'src/macros.c')
| -rw-r--r-- | src/macros.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/src/macros.c b/src/macros.c index 07667f09431..4730a8becc9 100644 --- a/src/macros.c +++ b/src/macros.c | |||
| @@ -87,16 +87,13 @@ macro before appending to it. */) | |||
| 87 | /* Check the type of last-kbd-macro in case Lisp code changed it. */ | 87 | /* Check the type of last-kbd-macro in case Lisp code changed it. */ |
| 88 | len = CHECK_VECTOR_OR_STRING (KVAR (current_kboard, Vlast_kbd_macro)); | 88 | len = CHECK_VECTOR_OR_STRING (KVAR (current_kboard, Vlast_kbd_macro)); |
| 89 | 89 | ||
| 90 | if (INT_ADD_OVERFLOW (len, incr)) | ||
| 91 | memory_full (SIZE_MAX); | ||
| 92 | |||
| 93 | /* Copy last-kbd-macro into the buffer, in case the Lisp code | 90 | /* Copy last-kbd-macro into the buffer, in case the Lisp code |
| 94 | has put another macro there. */ | 91 | has put another macro there. */ |
| 95 | if (current_kboard->kbd_macro_bufsize < len + incr) | 92 | if (current_kboard->kbd_macro_bufsize - incr < len) |
| 96 | current_kboard->kbd_macro_buffer = | 93 | current_kboard->kbd_macro_buffer = |
| 97 | xpalloc (current_kboard->kbd_macro_buffer, | 94 | xpalloc (current_kboard->kbd_macro_buffer, |
| 98 | ¤t_kboard->kbd_macro_bufsize, | 95 | ¤t_kboard->kbd_macro_bufsize, |
| 99 | len + incr - current_kboard->kbd_macro_bufsize, -1, | 96 | len - current_kboard->kbd_macro_bufsize + incr, -1, |
| 100 | sizeof *current_kboard->kbd_macro_buffer); | 97 | sizeof *current_kboard->kbd_macro_buffer); |
| 101 | 98 | ||
| 102 | /* Must convert meta modifier when copying string to vector. */ | 99 | /* Must convert meta modifier when copying string to vector. */ |