Hi Frank,

On Fri, 2020-03-20 at 21:37 -0400, Frank Ch. Eigler via Elfutils-devel wrote:
> Slice 2/3, the debuginfod_client get_url function.  This new
> version works during or after the progressfn callback.
> 
> Author: Frank Ch. Eigler <f...@redhat.com>
> Date:   Fri Mar 20 21:33:52 2020 -0400
> 
>     debuginfod client API: add get_url function
>     
>     This function lets a client know, during or after a progressfn
>     callback, what the url of the winning outgoing download is/was.

Looks good.

The only potential issue I see with this is the use of PATH_MAX and
strncpy, which potentially chops off the URL at an arbitrary place that
cannot easily be detected.

On my system PATH_MAX is "only" 1024 chars. This might seem large, but
a non-contrived (source) URL can already be > 200 chars (start of the
URL ~50 chars, the build-id ~40 chars, "source" plus a whole source
PATH). It is not completely theoretical that (generated) source paths
would exceed 1024 chars.

I think it would be good to just initialize to NULL and use strdup and
free to store/manage it. That would also make the interface slightly
simpler, so the client doesn't have to check for the empty string, just
for NULL.

Cheers,

Mark

Reply via email to