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.

MFC after:	1 week
This commit is contained in:
Dimitry Andric 2016-08-30 20:27:22 +00:00
parent deda53cd9b
commit 866616de6e

View File

@ -112,7 +112,7 @@ static int send_tncmd(void (*)(int, int), const char *, char *);
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;