Source-Changes-HG archive

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

[src/trunk]: src/lib/libwrap Avoid setjmp clobbering.



details:   https://anonhg.NetBSD.org/src/rev/3a6bb57de47e
branches:  trunk
changeset: 344199:3a6bb57de47e
user:      christos <christos%NetBSD.org@localhost>
date:      Wed Mar 16 21:38:22 2016 +0000

description:
Avoid setjmp clobbering.

diffstat:

 lib/libwrap/rfc931.c |  17 ++++++-----------
 1 files changed, 6 insertions(+), 11 deletions(-)

diffs (62 lines):

diff -r 40585042f06d -r 3a6bb57de47e lib/libwrap/rfc931.c
--- a/lib/libwrap/rfc931.c      Wed Mar 16 21:20:59 2016 +0000
+++ b/lib/libwrap/rfc931.c      Wed Mar 16 21:38:22 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rfc931.c,v 1.10 2012/03/22 22:59:43 joerg Exp $        */
+/*     $NetBSD: rfc931.c,v 1.11 2016/03/16 21:38:22 christos Exp $     */
 
  /*
   * rfc931() speaks a common subset of the RFC 931, AUTH, TAP, IDENT and RFC
@@ -16,7 +16,7 @@
 #if 0
 static char sccsid[] = "@(#) rfc931.c 1.10 95/01/02 16:11:34";
 #else
-__RCSID("$NetBSD: rfc931.c,v 1.10 2012/03/22 22:59:43 joerg Exp $");
+__RCSID("$NetBSD: rfc931.c,v 1.11 2016/03/16 21:38:22 christos Exp $");
 #endif
 #endif
 
@@ -87,7 +87,7 @@
     char    user[256];                 /* XXX */
     char    buffer[512];               /* XXX */
     char   *cp;
-    char   *result = unknown;
+    static char   *result = unknown;
     FILE   *fp;
     volatile int salen;
     u_short * volatile rmt_portp;
@@ -95,7 +95,7 @@
 
     /* address family must be the same */
     if (rmt_sin->sa_family != our_sin->sa_family) {
-       strlcpy(dest, result, STRING_LENGTH);
+       strlcpy(dest, unknown, STRING_LENGTH);
        return;
     }
     switch (rmt_sin->sa_family) {
@@ -110,7 +110,7 @@
        break;
 #endif
     default:
-       strlcpy(dest, result, STRING_LENGTH);
+       strlcpy(dest, unknown, STRING_LENGTH);
        return;
     }
     switch (our_sin->sa_family) {
@@ -123,15 +123,10 @@
        break;
 #endif
     default:
-       strlcpy(dest, result, STRING_LENGTH);
+       strlcpy(dest, unknown, STRING_LENGTH);
        return;
     }
 
-#ifdef __GNUC__
-    (void)&result; /* Avoid longjmp clobbering */
-    (void)&fp; /* XXX gcc */
-#endif
-
     /*
      * Use one unbuffered stdio stream for writing to and for reading from
      * the RFC931 etc. server. This is done because of a bug in the SunOS



Home | Main Index | Thread Index | Old Index