xcursor: Fix allocation based on string length
authorRob Bradford <rob@linux.intel.com>
Tue, 9 Oct 2012 17:46:21 +0000 (18:46 +0100)
committerKristian Høgsberg <krh@bitplanet.net>
Wed, 10 Oct 2012 03:01:23 +0000 (23:01 -0400)
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 <rob@linux.intel.com>
cursor/xcursor.c

index 1f66bce..7a9662a 100644 (file)
@@ -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;