On Tue, Oct 09, 2012 at 06:46:21PM +0100, Rob Bradford wrote:
> 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.

Yeah, that's a little tricky, but it looks right to me.

Kristian

> 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
_______________________________________________
wayland-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/wayland-devel

Reply via email to