/*
- * $Id: nbp.c,v 1.5.2.1 2001-12-31 20:05:20 srittau Exp $
+ * $Id: nbp.c,v 1.5.2.2 2002-02-07 23:58:46 srittau Exp $
*
* Copyright (c) 1990,1993 Regents of The University of Michigan.
* All Rights Reserved. See COPYRIGHT.
struct rtmptab *rtmp;
char *end, *nbpop, *zonep, packet[ ATP_BUFSIZ ];
int n, i, cc, locallkup;
+ u_char tmplen;
end = data + len;
if ( data >= end ) {
nn.nn_sat.sat_port = nt.nt_port;
/* object */
- if ( data >= end || ( *data < 0 || *data > 32 ) || data + *data > end ) {
+ tmplen = (u_char) *data;
+ if ( data >= end || tmplen > 32 || data + tmplen > end ) {
syslog( LOG_INFO, "nbp_packet: malformed packet" );
return 1;
}
- nn.nn_objlen = *data++;
+ nn.nn_objlen = tmplen;
+ data++;
memcpy( nn.nn_obj, data, nn.nn_objlen );
data += nn.nn_objlen;
/* type */
- if ( data >= end || ( *data < 0 || *data > 32 ) || data + *data > end ) {
+ tmplen = (u_char) *data;
+ if ( data >= end || tmplen > 32 || data + tmplen > end ) {
syslog( LOG_INFO, "nbp_packet: malformed packet" );
return 1;
}
- nn.nn_typelen = *data++;
+ nn.nn_typelen = tmplen;
+ data++;
memcpy( nn.nn_type, data, nn.nn_typelen );
data += nn.nn_typelen;
/* zone */
- if ( data >= end || ( *data < 0 || *data > 32 ) || data + *data > end ) {
+ tmplen = (u_char) *data;
+ if ( data >= end || tmplen > 32 || data + tmplen > end ) {
syslog( LOG_INFO, "nbp_packet: malformed packet" );
return 1;
}
zonep = data; /* remember for fwd */
- nn.nn_zonelen = *data++;
+ nn.nn_zonelen = tmplen;
+ data++;
memcpy( nn.nn_zone, data, nn.nn_zonelen );
data += nn.nn_zonelen;
/*
- * $Id: atp_packet.c,v 1.4 2001-08-15 02:17:57 srittau Exp $
+ * $Id: atp_packet.c,v 1.4.2.1 2002-02-08 00:03:27 srittau Exp $
*
* Copyright (c) 1990,1991 Regents of The University of Michigan.
* All Rights Reserved.
/* set length
*/
- pktbuf->atpbuf_dlen = ATP_HDRSIZE + atpb->atp_sreqdlen;
+ pktbuf->atpbuf_dlen = ATP_HDRSIZE + (size_t) atpb->atp_sreqdlen;
}
void atp_build_resp_packet( struct atpbuf *pktbuf,
/* set length
*/
- pktbuf->atpbuf_dlen = ATP_HDRSIZE + atpb->atp_sresiov[ seqnum ].iov_len;
+ pktbuf->atpbuf_dlen = ATP_HDRSIZE + (size_t) atpb->atp_sresiov[ seqnum ].iov_len;
}
if ( cq != NULL ) {
/* we found one in the queue -- copy to rbuf
*/
- dlen = cq->atpbuf_dlen;
+ dlen = (int) cq->atpbuf_dlen;
*func = rfunc;
memcpy( fromaddr, &cq->atpbuf_addr, sizeof( struct sockaddr_at ));
memcpy( rbuf, cq->atpbuf_info.atpbuf_data, cq->atpbuf_dlen );
memcpy( &inbuf->atpbuf_addr, &faddr,
sizeof( struct sockaddr_at ));
inbuf->atpbuf_next = ah->atph_queue;
- inbuf->atpbuf_dlen = recvlen;
+ inbuf->atpbuf_dlen = (size_t) recvlen;
memcpy( inbuf->atpbuf_info.atpbuf_data, rbuf, recvlen );
}
}
/*
- * $Id: atp_rresp.c,v 1.4 2001-06-29 14:14:46 rufustfirefly Exp $
+ * $Id: atp_rresp.c,v 1.4.2.1 2002-02-08 00:03:27 srittau Exp $
*
* Copyright (c) 1990,1991 Regents of The University of Michigan.
* All Rights Reserved.
ATP ah; /* open atp handle */
struct atp_block *atpb; /* parameter block */
{
- int len, i, rc;
+ int i, rc;
+ size_t len;
#ifdef EBUG
atp_print_bufuse( ah, "atp_rresp" );
return( -1 );
}
#ifdef EBUG
- fprintf( stderr, "atp_rresp copying %d bytes packet %d\n",
+ fprintf( stderr, "atp_rresp copying %ld bytes packet %d\n",
len, i );
bprint( (char *)ah->atph_resppkt[ i ]->atpbuf_info.atpbuf_data,
len + ATP_HDRSIZE );
/*
- * $Id: atp_rsel.c,v 1.3 2001-06-29 14:14:46 rufustfirefly Exp $
+ * $Id: atp_rsel.c,v 1.3.2.1 2002-02-08 00:03:27 srittau Exp $
*
* Copyright (c) 1990,1997 Regents of The University of Michigan.
* All Rights Reserved. See COPYRIGHT.
struct atphdr req_hdr;
#ifdef EBUG
- printf( "\n<%d> resend_request: resending %d byte request packet",
+ printf( "\n<%d> resend_request: resending %ld byte request packet",
getpid(), ah->atph_reqpkt->atpbuf_dlen );
atp_print_addr( " to", &ah->atph_reqpkt->atpbuf_addr );
putchar( '\n' );
bprint( abuf->atpbuf_info.atpbuf_data, recvlen );
#endif /* EBUG */
- abuf->atpbuf_dlen = recvlen;
+ abuf->atpbuf_dlen = (size_t) recvlen;
memcpy( &resp_hdr, abuf->atpbuf_info.atpbuf_data + 1,
sizeof( struct atphdr ));
/*
- * $Id: atp_sreq.c,v 1.4 2001-08-15 02:17:57 srittau Exp $
+ * $Id: atp_sreq.c,v 1.4.2.1 2002-02-08 00:03:27 srittau Exp $
*
* Copyright (c) 1990,1991 Regents of The University of Michigan.
* All Rights Reserved.
/* send the initial request
*/
#ifdef EBUG
- printf( "\n<%d> atp_sreq: sending a %d byte packet ", getpid(),
+ printf( "\n<%d> atp_sreq: sending a %ld byte packet ", getpid(),
req_buf->atpbuf_dlen );
atp_print_addr( " to", atpb->atp_saddr );
putchar( '\n' );
/*
- * $Id: dsi_stream.c,v 1.4 2001-08-15 02:18:57 srittau Exp $
+ * $Id: dsi_stream.c,v 1.4.2.1 2002-02-08 00:03:29 srittau Exp $
*
* Copyright (c) 1998 Adrian Sun (asun@zoology.washington.edu)
* All rights reserved. See COPYRIGHT.
stored = 0;
while (stored < length) {
- if ((len = read(dsi->socket, (u_int8_t *) data + stored,
- length - stored)) == -1 && errno == EINTR)
+ len = read(dsi->socket, (u_int8_t *) data + stored, length - stored);
+ if (len == -1 && errno == EINTR)
continue;
- if (len > 0)
+ else if (len > 0)
stored += len;
- else {/* eof or error */
+ else { /* eof or error */
syslog(LOG_ERR, "dsi_stream_read(%d): %s", len, strerror(errno));
break;
}