Potential crash due to missing declaration of strerror
Damien Miller
djm at mindrot.org
Sun Dec 8 08:23:15 EST 2013
applied - thanks.
On Sat, 7 Dec 2013, Corinna Vinschen wrote:
> Hi,
>
> I've just stumbled over this gcc warning while building OpenSSH:
>
> openbsd-compat/bsd-setres_id.c:41:3: warning: implicit declaration of function ?strerror? [-Wimplicit-function-declaration]
> error("setregid %u: %.100s", rgid, strerror(errno));
> ^
> openbsd-compat/bsd-setres_id.c:41:3: warning: format ?%s? expects argument of type ?char *?, but argument 3 has type ?int? [-Wformat=]
>
> This almost certainly results in a crash on systems with
> sizeof(char*) > sizeof(int), like on practically all 64 bit systems.
>
> This simple patch fixes it:
>
> Index: openbsd-compat/bsd-setres_id.c
> ===================================================================
> RCS file: /cvs/openssh/openbsd-compat/bsd-setres_id.c,v
> retrieving revision 1.1
> diff -u -p -r1.1 bsd-setres_id.c
> --- openbsd-compat/bsd-setres_id.c 5 Nov 2012 06:04:37 -0000 1.1
> +++ openbsd-compat/bsd-setres_id.c 7 Dec 2013 10:57:31 -0000
> @@ -22,6 +22,7 @@
>
> #include <stdarg.h>
> #include <unistd.h>
> +#include <string.h>
>
> #include "log.h"
>
>
> Hope that helps,
> Corinna
>
More information about the openssh-unix-dev
mailing list