two problems where fixes are needed

Werner Koch wk at gnupg.org
Mon Oct 24 09:24:56 CEST 2016


On Thu, 20 Oct 2016 13:30, gniibe at fsij.org said:

> (1) agent_write_private_key function in agent/findkey.c
>
> It fails with "No such file or directory" well when FORCE=1 and there
> is no file existed.

You mean in the case a second process removed the file?

> (2) snprintf and its second arg for the size.

> ./g10/call-agent.c:761:  snprintf (line, DIM(line)-1, [...]

Before we switched to our own snprintf we took care of buggy snprintf
implementations which appened a Nul behind the buffer.  The -1 is a
left-over over this.  Given that tehse are constants I do not think it
makes sense to change to remove the "-1".

FWIW, for new code I use

  snprintf (buffer, sizeof buffer,  [...]

because DIM is never required as snprintf works only with byte strings
and the DIM is thus identical to sizeof.


Shalom-Salam,

   Werner

-- 
Die Gedanken sind frei.  Ausnahmen regelt ein Bundesgesetz.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 162 bytes
Desc: not available
URL: </pipermail/attachments/20161024/a9cb51d9/attachment-0001.sig>


More information about the Gnupg-devel mailing list