Potential crash due to missing declaration of strerror

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

 



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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://lists.mindrot.org/pipermail/openssh-unix-dev/attachments/20131207/75660104/attachment.bin>


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux