rxkad: Resolve warnings in ticket5.c
authorAnders Kaseorg <andersk@mit.edu>
Fri, 31 Jul 2015 05:42:55 +0000 (01:42 -0400)
committerBenjamin Kaduk <kaduk@mit.edu>
Fri, 25 Dec 2015 06:57:06 +0000 (01:57 -0500)
Resolves these warnings:

ticket5.c: In function ‘tkt_MakeTicket5’:
ticket5.c:574:33: warning: pointer targets in passing argument 1 of ‘_rxkad_v5_encode_EncTicketPart’ differ in signedness [-Wpointer-sign]
     code = encode_EncTicketPart(encodebuf, allocsiz, &data, &encodelen);
                                 ^
In file included from ticket5.c:80:0:
v5gen-rewrite.h:43:30: note: expected ‘unsigned char *’ but argument is of type ‘char *’
 #define encode_EncTicketPart _rxkad_v5_encode_EncTicketPart
                              ^
v5gen.c:1889:1: note: in expansion of macro ‘encode_EncTicketPart’
 encode_EncTicketPart(unsigned char *p, size_t len, const EncTicketPart * data, size_t * size)
 ^
ticket5.c:602:33: warning: pointer targets in passing argument 1 of ‘_rxkad_v5_encode_EncryptedData’ differ in signedness [-Wpointer-sign]
     code = encode_EncryptedData(ticket + *ticketLen - 1, *ticketLen, &encdata, &tl);
                                 ^
In file included from ticket5.c:80:0:
v5gen-rewrite.h:16:30: note: expected ‘unsigned char *’ but argument is of type ‘char *’
 #define encode_EncryptedData _rxkad_v5_encode_EncryptedData
                              ^
v5gen.c:690:1: note: in expansion of macro ‘encode_EncryptedData’
 encode_EncryptedData(unsigned char *p, size_t len, const EncryptedData * data, size_t * size)
 ^
ticket5.c: In function ‘tkt_DecodeTicket5’:
ticket5.c:320:10: warning: ‘plainsiz’ may be used uninitialized in this function [-Wmaybe-uninitialized]
     code = decode_EncTicketPart((unsigned char *)plain, plainsiz, &decr_part, &siz);
          ^

Change-Id: Ic1b878f01cf82222dc258847747ce192ee5948fc
Reviewed-on: http://gerrit.openafs.org/11955
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

CODING
src/rxkad/Makefile.in
src/rxkad/ticket5.c

diff --git a/CODING b/CODING
index 0881c98..6a1af05 100644 (file)
--- a/CODING
+++ b/CODING
@@ -262,7 +262,6 @@ libadmin/kas/afs_kasAdmin.c: strict-proto : ubik_Call nonsense
 libadmin/samples/rxstat_query_peer.c : all : util_RPCStatsStateGet types
 libadmin/samples/rxstat_query_process.c : all : util_RPCStatsStateGet types
 libadmin/test/client.c : all         : util_RPCStatsStateGet types
-rxkad/ticket5.c             : all           : v5gen.c has set-but-unused variables
 ubik/ubikclient.c    : strict-protos : ubik_Call
 volser/vol-dump.c    : format        : afs_sfsize_t
 
index 9ecf4e4..8f60b9e 100644 (file)
@@ -81,8 +81,6 @@ liboafs_rxkad.la: liboafs_rxkad.la.sym $(LT_objs) $(LT_deps)
 librxkad_pic.la: $(LT_objs)
        $(LT_LDLIB_pic) $(LT_objs)
 
-CFLAGS_ticket5.lo = @CFLAGS_NOERROR@
-
 crc.lo: crc.c ${INCLS}
 crypt_conn.lo: crypt_conn.c fcrypt.h private_data.h ${INCLS}
 fcrypt.lo: fcrypt.c fcrypt.h sboxes.h rxkad.h rxkad_prototypes.h
index 5a53163..7b8eb50 100644 (file)
@@ -198,7 +198,7 @@ tkt_DecodeTicket5(char *ticket, afs_int32 ticket_len,
     Ticket t5;                 /* Must free */
     EncTicketPart decr_part;   /* Must free */
     int code;
-    size_t siz, plainsiz;
+    size_t siz, plainsiz = 0;
     int v5_serv_kvno;
     char *v5_comp0, *v5_comp1, *c;
     const struct krb_convert *p;
@@ -536,7 +536,7 @@ tkt_MakeTicket5(char *ticket, int *ticketLen, int enctype, int *kvno,
 {
     EncTicketPart data;
     EncryptedData encdata;
-    char *buf, *encodebuf;
+    unsigned char *buf, *encodebuf;
     size_t encodelen, allocsiz;
     heim_general_string carray[2];
     int code;
@@ -599,7 +599,7 @@ tkt_MakeTicket5(char *ticket, int *ticketLen, int enctype, int *kvno,
        goto cleanup;
     }
     tl=*ticketLen;
-    code = encode_EncryptedData(ticket + *ticketLen - 1, *ticketLen, &encdata, &tl);
+    code = encode_EncryptedData((unsigned char *)ticket + *ticketLen - 1, *ticketLen, &encdata, &tl);
     if (code == 0) {
        *kvno=RXKAD_TKT_TYPE_KERBEROS_V5_ENCPART_ONLY;
        /*