[systemd-devel] [PATCH 2/5] sd-id128: properly check position in buffer

Zbigniew Jędrzejewski-Szmek zbyszek at in.waw.pl
Wed Apr 10 16:06:10 PDT 2013


On Wed, Apr 10, 2013 at 12:53:59PM +0200, Lukas Nykryn wrote:
> ---
>  src/libsystemd-id128/sd-id128.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/src/libsystemd-id128/sd-id128.c b/src/libsystemd-id128/sd-id128.c
> index 68c4987..a6345c8 100644
> --- a/src/libsystemd-id128/sd-id128.c
> +++ b/src/libsystemd-id128/sd-id128.c
> @@ -176,6 +176,9 @@ _public_ int sd_id128_get_boot(sd_id128_t *ret) {
>                  if (*p == '-')
>                          p++;
>  
> +                if (p >= buf + k - 1)
> +                        return -EIO;
> +
Somethign like that is already in master. (There's only a difference of one
between the checks,  p >= buf + k - 1 or p >= buf + k. Both are correct.)

Zbyszek


More information about the systemd-devel mailing list