Hi Florian,

Today Florian Forster wrote:

> The "get_path" function is called at least from "rrdc_update" without
> checking for a connection first. In that case the "sd_path" pointer may be
> NULL, so dereferencing it without checking for NULL is not good behavior.
>
> This patch checks all arguments of the "get_path" function and returns an
> error if any pointer is NULL.

thanks for the patch
tobi

> ---
>  src/rrd_client.c |    3 +++
>  1 files changed, 3 insertions(+), 0 deletions(-)
>
> diff --git a/src/rrd_client.c b/src/rrd_client.c
> index d292281..0d21283 100644
> --- a/src/rrd_client.c
> +++ b/src/rrd_client.c
> @@ -73,6 +73,9 @@ static const char *get_path (const char *path, char 
> *resolved_path) /* {{{ */
>    const char *ret = path;
>    int is_unix = 0;
>
> +  if ((path == NULL) || (resolved_path == NULL) || (sd_path == NULL))
> +    return (NULL);
> +
>    if ((*sd_path == '/')
>        || (strncmp ("unix:", sd_path, strlen ("unix:")) == 0))
>      is_unix = 1;
>

-- 
Tobi Oetiker, OETIKER+PARTNER AG, Aarweg 15 CH-4600 Olten, Switzerland
http://it.oetiker.ch [email protected] ++41 62 775 9902 / sb: -9900

_______________________________________________
rrd-developers mailing list
[email protected]
https://lists.oetiker.ch/cgi-bin/listinfo/rrd-developers

Reply via email to