[systemd-devel] [PATCH 5/6] coredumpctl: null check before dereferencing
Michal Schmidt
mschmidt at redhat.com
Thu Oct 25 08:12:40 PDT 2012
On 10/25/2012 04:16 PM, Michal Sekletar wrote:
> ---
> src/journal/coredumpctl.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/src/journal/coredumpctl.c b/src/journal/coredumpctl.c
> index d15a31e..1a4d78f 100644
> --- a/src/journal/coredumpctl.c
> +++ b/src/journal/coredumpctl.c
> @@ -222,6 +222,7 @@ static int retrieve(sd_journal *j, const char *name, const char **var) {
>
> field = strlen(name) + 1; // name + "="
> assert(len >= field);
> + assert(var);
>
> *var = strndup((const char*)data + field, len - field);
> if (!var)
It looks like this check really wants to be "if (!*var)"
Michal
More information about the systemd-devel
mailing list