summary |
shortlog |
log |
commit | commitdiff |
review |
tree
raw |
patch |
inline | side by side (from parent 1:
61c5dda)
It was possible for the route table collector to allocate
a zero length buffer to copy a received message into.
Change-Id: Ie270f7fe9f721661f59713eaf15500762b2b3253
Signed-off-by: E. Scott Daniels <daniels@research.att.com>
set( major_version "1" )
set( minor_version "0" )
set( major_version "1" )
set( minor_version "0" )
set( install_root "${CMAKE_INSTALL_PREFIX}" )
set( install_lib "lib" )
set( install_root "${CMAKE_INSTALL_PREFIX}" )
set( install_lib "lib" )
int state; // processing state of some nng function
char* tokens[128];
char wbuf[128];
int state; // processing state of some nng function
char* tokens[128];
char wbuf[128];
int pbuf_size = 0; // number allocated in pbuf
int ntoks;
int raw_interface = 1; // rtg is using raw NNG/Nano not RMr to send updates
int pbuf_size = 0; // number allocated in pbuf
int ntoks;
int raw_interface = 1; // rtg is using raw NNG/Nano not RMr to send updates
if( pbuf ) {
free( pbuf );
}
if( pbuf ) {
free( pbuf );
}
- pbuf = (char *) malloc( sizeof( char ) * mlen *2 );
- pbuf_size = mlen * 2;
+ if( mlen < 512 ) {
+ pbuf_size = 512;
+ } else {
+ pbuf_size = mlen * 2;
+ }
+ pbuf = (char *) malloc( sizeof( char ) * pbuf_size );
}
memcpy( pbuf, payload, mlen );
pbuf[mlen] = 0; // don't depend on sender making this a legit string
}
memcpy( pbuf, payload, mlen );
pbuf[mlen] = 0; // don't depend on sender making this a legit string
nm->payload = nm->header + sizeof( uta_mhdr_t ); // point past header to payload (single buffer allocation above)
nm->xaction = ((uta_mhdr_t *)nm->header)->xid; // point at transaction id in header area
nm->state = old_msg->state; // fill in caller's state (likely the state of the last operation)
nm->payload = nm->header + sizeof( uta_mhdr_t ); // point past header to payload (single buffer allocation above)
nm->xaction = ((uta_mhdr_t *)nm->header)->xid; // point at transaction id in header area
nm->state = old_msg->state; // fill in caller's state (likely the state of the last operation)
- nm->flags |= MFL_ZEROCOPY; // this is a zerocopy sendable message
+ nm->flags = old_msg->flags | MFL_ZEROCOPY; // this is a zerocopy sendable message
memcpy( ((uta_mhdr_t *)nm->header)->src, ((uta_mhdr_t *)old_msg->header)->src, RMR_MAX_SID );
memcpy( nm->payload, old_msg->payload, old_msg->len );
memcpy( ((uta_mhdr_t *)nm->header)->src, ((uta_mhdr_t *)old_msg->header)->src, RMR_MAX_SID );
memcpy( nm->payload, old_msg->payload, old_msg->len );