From: Rob Bradford <[email protected]>

strlen() doesn't include the terminating NUL. Therefore when allocating a
block of memory to hold something equivalent to the length of the string we
must increment to take the NUL byte into consideration.

Signed-off-by: Rob Bradford <[email protected]>
---
 cursor/xcursor.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/cursor/xcursor.c b/cursor/xcursor.c
index 1f66bce..7a9662a 100644
--- a/cursor/xcursor.c
+++ b/cursor/xcursor.c
@@ -757,7 +757,7 @@ _XcursorThemeInherits (const char *full)
                if (*l != '=') continue;
                l++;
                while (*l == ' ') l++;
-               result = malloc (strlen (l));
+               result = malloc (strlen (l) + 1);
                if (result)
                {
                    r = result;
-- 
1.7.11.2

_______________________________________________
wayland-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/wayland-devel

Reply via email to