Skip to content
Snippets Groups Projects
Commit 08ff129e authored by tewk's avatar tewk
Browse files

Added asserts around memcpy for pack_??_info_msg routines. These are memcopying

buffers that are pre-build by slurmctl, using the old inline pack, and for this reason
did not use the assert checked functions
parent d22b5bac
No related branches found
No related tags found
No related merge requests found
......@@ -267,7 +267,13 @@ int unpack_node_registration_status_msg ( node_registration_status_msg_t ** msg
void pack_node_info_msg ( slurm_msg_t * msg, void ** buf_ptr , int * buffer_size )
{
memcpy ( *buf_ptr , msg->data , msg->data_size );
assert ( msg != NULL );
assert ( sizeof(*msg) == sizeof(slurm_msg_t) ) ;
assert ( buf_ptr != NULL && (*buf_ptr) != NULL ) ;
assert ( ( buffer_size ) != NULL ) ;
assert ( *buffer_size >= msg->data_size );
memcpy ( *buf_ptr , msg->data , msg->data_size );
(*buf_ptr) += msg->data_size;
(*buffer_size) -= msg->data_size;
}
......@@ -324,6 +330,12 @@ int unpack_node_table ( node_table_msg_t * node , void ** buf_ptr , int * buffer
void pack_partition_info_msg ( slurm_msg_t * msg, void ** buf_ptr , int * buffer_size )
{
assert ( msg != NULL );
assert ( sizeof(*msg) == sizeof(slurm_msg_t) ) ;
assert ( buf_ptr != NULL && (*buf_ptr) != NULL ) ;
assert ( (buffer_size) != NULL ) ;
assert ( *buffer_size >= msg->data_size );
memcpy ( *buf_ptr , msg->data , msg->data_size );
(*buf_ptr) += msg->data_size;
(*buffer_size) -= msg->data_size;
......@@ -398,6 +410,12 @@ int unpack_partition_table ( partition_table_msg_t * part , void ** buf_ptr , in
void pack_job_info_msg ( slurm_msg_t * msg, void ** buf_ptr , int * buffer_size )
{
assert ( msg != NULL );
assert ( sizeof(*msg) == sizeof(slurm_msg_t) ) ;
assert ( buf_ptr != NULL && (*buf_ptr) != NULL ) ;
assert ( (buffer_size) != NULL ) ;
assert ( *buffer_size >= msg->data_size );
memcpy ( *buf_ptr , msg->data , msg->data_size );
(*buf_ptr) += msg->data_size;
(*buffer_size) -= msg->data_size;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment