Re: [PATCH] btrfs-progs: don't overrun "answer" array in cmds-chunk.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Aug 05, 2013 at 09:52:57PM -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';

*high fives*

> -	answer[5] = '\0';
> +	answer[4] = '\0';

I went to see which way of avoiding another magical raw constant would
be best and did a bit of a double take.

If you're in here, want to reimplement this thing in a few lines of
scanf(%s) and strcasecmp()?  I can give it a go if you don't want to.

- z
--
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




[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux