[gtksourceview] Make sure to NULL terminate text for unowned buffers
- From: Jesse van den Kieboom <jessevdk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtksourceview] Make sure to NULL terminate text for unowned buffers
- Date: Wed, 27 Aug 2014 12:33:06 +0000 (UTC)
commit 3e30d95e74b191c12cfa28bbf7d6116cc15313dd
Author: Jesse van den Kieboom <jessevdk gmail com>
Date: Wed Aug 27 14:32:44 2014 +0200
Make sure to NULL terminate text for unowned buffers
This fixes the case where the stream gets passed in a valid buffer
(i.e. unowned) which we cannot know is null terminated or not.
gtksourceview/gtksourcebufferoutputstream.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/gtksourceview/gtksourcebufferoutputstream.c b/gtksourceview/gtksourcebufferoutputstream.c
index 6511d32..a71e4e7 100644
--- a/gtksourceview/gtksourcebufferoutputstream.c
+++ b/gtksourceview/gtksourcebufferoutputstream.c
@@ -653,7 +653,7 @@ validate_and_insert (GtkSourceBufferOutputStream *stream,
apply_error_tag (stream);
- if (nvalid != len && buffer[nvalid] != '\0')
+ if ((nvalid != len || !owned) && buffer[nvalid] != '\0')
{
/* make sure the buffer is always properly null
* terminated. This is needed, at least for now,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]