On mon, 05 Aug 2013 21:52:57 -0500, Eric Sandeen wrote:
> If an array is 5 chars in size:
>
> char answer[5];
>
> and we write the 6th char (counting from 0)...
>
> answer[5] = '\0';
>
> we get problems:
>
> cmds-chunk.c: In function 'ask_user.clone.0':
> cmds-chunk.c:1343: warning: array subscript is above array bounds
>
> Fix it...
>
> Signed-off-by: Eric Sandeen <sandeen@xxxxxxxxxx>
> ---
Thanks to fix this problem.
Reviewed-by: Miao Xie <miaox@xxxxxxxxxxxxxx>
>
>
> diff --git a/cmds-chunk.c b/cmds-chunk.c
> index 03314de..7c3257c 100644
> --- a/cmds-chunk.c
> +++ b/cmds-chunk.c
> @@ -1340,7 +1340,7 @@ again:
> }
> i++;
> }
> - answer[5] = '\0';
> + answer[4] = '\0';
> __fpurge(stdin);
>
> if (strlen(answer) == 0) {
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html