Hi Aaron,

On Wed, May 13, 2026 at 04:59:47PM -0400, Aaron Merey wrote:
> >
> > +    /* Don't trust the size the server sent us, double check against the
> > +       file size that we actually got.  That way we calculate the hash
> > +       over the whole file and not a shorter (possibly empty) data size.  
> > */
> > +    struct stat st;
> > +    if (fstat (fd, &st) == -1)
> > +    {
> > +      rc = -errno;
> > +      goto exit_validate;
> > +    }
> > +    if (data_len != st.st_size)
> > +    {
> > +      rc = -EINVAL;
> > +      goto exit_validate;
> 
> It might be worth logging the reason for this error to verbose_fd, if
> it's set.

None of the prelimenary checks that goto exit_validate do that. I
don't think this is very different to those that we have to verbose
log this specific one.

> Also this function's docstring says -EINVAL indicates
> "signature invalidity". This size mismatch is arguably a kind of
> signature invalidity, but OTOH we could use a different errno here
> (-EBADMSG?).

OK. Will sent v2.

Cheers,

Mark

Reply via email to