editor: Improve checks on delete add asserts

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
dev
Jan Arne Petersen 12 years ago committed by Kristian Høgsberg
parent 9eaa8e51ca
commit 895a128ce1
  1. 6
      clients/editor.c

@ -214,7 +214,8 @@ text_input_delete_surrounding_text(void *data,
return;
}
if (entry->pending_commit.delete_index + length > text_length) {
if (length > text_length ||
entry->pending_commit.delete_index + length > text_length) {
fprintf(stderr, "Invalid length %d\n", length);
entry->pending_commit.delete_length = 0;
return;
@ -837,6 +838,9 @@ text_entry_delete_text(struct text_entry *entry,
{
uint32_t l;
assert(index <= strlen(entry->text));
assert(index + length <= strlen(entry->text));
assert(index + length >= length);
l = strlen(entry->text + index + length);
memmove(entry->text + index,

Loading…
Cancel
Save