svn commit: r305552 - in stable: 10/contrib/telnet/libtelnet 10/contrib/telnet/telnet 10/usr.bin/newkey 11/contrib/telnet/libtelnet 11/contrib/telnet/telnet 11/usr.bin/newkey 9/contrib/telnet/libte...

Dimitry Andric dim at FreeBSD.org
Wed Sep 7 18:22:09 UTC 2016


Author: dim
Date: Wed Sep  7 18:22:08 2016
New Revision: 305552
URL: https://svnweb.freebsd.org/changeset/base/305552

Log:
  MFC r305077:
  
  Squelch clang 3.9.0 warnings about BASE (which is 32768) being converted
  to -32768 when it is used as an argument to mp_itom(), in both libtelnet
  and newkey.  This code has been wrong since r26238 (!), so after almost
  20 years it is rather useless to try to correct it.
  
  MFC r305086:
  
  Fix warnings in telnet about invalid constant conversions, e.g.:
  
  contrib/telnet/telnet/commands.c:2914:13: error: implicit conversion
  from 'int' to 'char' changes value from 137 to -119
  [-Werror,-Wconstant-conversion]
  		*lsrp++ = IPOPT_SSRR;
  			~ ^~~~~~~~~~
  /usr/include/netinet/ip.h:152:21: note: expanded from macro 'IPOPT_SSRR'
  #define IPOPT_SSRR              137             /* strict source route */
  				^~~
  contrib/telnet/telnet/commands.c:2916:13: error: implicit conversion
  from 'int' to 'char' changes value from 131 to -125
  [-Werror,-Wconstant-conversion]
  		*lsrp++ = IPOPT_LSRR;
  			~ ^~~~~~~~~~
  /usr/include/netinet/ip.h:148:21: note: expanded from macro 'IPOPT_LSRR'
  #define IPOPT_LSRR              131             /* loose source route */
  				^~~
  
  Use unsigned char buffers instead.

Modified:
  stable/9/contrib/telnet/libtelnet/pk.c
  stable/9/contrib/telnet/telnet/commands.c
  stable/9/usr.bin/newkey/generic.c
Directory Properties:
  stable/9/   (props changed)
  stable/9/contrib/   (props changed)
  stable/9/contrib/telnet/   (props changed)
  stable/9/usr.bin/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/10/contrib/telnet/libtelnet/pk.c
  stable/10/contrib/telnet/telnet/commands.c
  stable/10/usr.bin/newkey/generic.c
  stable/11/contrib/telnet/libtelnet/pk.c
  stable/11/contrib/telnet/telnet/commands.c
  stable/11/usr.bin/newkey/generic.c
Directory Properties:
  stable/10/   (props changed)
  stable/11/   (props changed)

Modified: stable/9/contrib/telnet/libtelnet/pk.c
==============================================================================
--- stable/9/contrib/telnet/libtelnet/pk.c	Wed Sep  7 18:20:49 2016	(r305551)
+++ stable/9/contrib/telnet/libtelnet/pk.c	Wed Sep  7 18:22:08 2016	(r305552)
@@ -164,7 +164,7 @@ genkeys(char *public, char *secret)
         MINT *pk = mp_itom(0);
         MINT *sk = mp_itom(0);
         MINT *tmp;
-        MINT *base = mp_itom(BASE);
+        MINT *base = mp_itom((short)BASE);
         MINT *root = mp_itom(PROOT);
         MINT *modulus = mp_xtom(HEXMODULUS);
         short r;

Modified: stable/9/contrib/telnet/telnet/commands.c
==============================================================================
--- stable/9/contrib/telnet/telnet/commands.c	Wed Sep  7 18:20:49 2016	(r305551)
+++ stable/9/contrib/telnet/telnet/commands.c	Wed Sep  7 18:22:08 2016	(r305552)
@@ -112,7 +112,7 @@ static int send_tncmd(void (*)(int, int)
 static int setmod(int);
 static int clearmode(int);
 static int modehelp(void);
-static int sourceroute(struct addrinfo *, char *, char **, int *, int *, int *);
+static int sourceroute(struct addrinfo *, char *, unsigned char **, int *, int *, int *);
 
 typedef struct {
 	const char *name;	/* command name */
@@ -2171,7 +2171,7 @@ switch_af(struct addrinfo **aip)
 int
 tn(int argc, char *argv[])
 {
-    char *srp = 0;
+    unsigned char *srp = 0;
     int proto, opt;
     int srlen;
     int srcroute = 0, result;
@@ -2844,10 +2844,10 @@ cmdrc(char *m1, char *m2)
  *		setsockopt, as socket protocol family.
  */
 static int
-sourceroute(struct addrinfo *ai, char *arg, char **cpp, int *lenp, int *protop, int *optp)
+sourceroute(struct addrinfo *ai, char *arg, unsigned char **cpp, int *lenp, int *protop, int *optp)
 {
 	static char buf[1024 + ALIGNBYTES];	/*XXX*/
-	char *cp, *cp2, *lsrp, *ep;
+	unsigned char *cp, *cp2, *lsrp, *ep;
 	struct sockaddr_in *_sin;
 #ifdef INET6
 	struct sockaddr_in6 *sin6;

Modified: stable/9/usr.bin/newkey/generic.c
==============================================================================
--- stable/9/usr.bin/newkey/generic.c	Wed Sep  7 18:20:49 2016	(r305551)
+++ stable/9/usr.bin/newkey/generic.c	Wed Sep  7 18:22:08 2016	(r305552)
@@ -82,7 +82,7 @@ genkeys(char *public, char *secret, char
 	MINT *pk = mp_itom(0);
 	MINT *sk = mp_itom(0);
 	MINT *tmp;
-	MINT *base = mp_itom(BASE);
+	MINT *base = mp_itom((short)BASE);
 	MINT *root = mp_itom(PROOT);
 	MINT *modulus = mp_xtom(HEXMODULUS);
 	short r;


More information about the svn-src-stable-9 mailing list