One byte low in memcopy in set_def ault_router_id

jan <[email protected]>
Newsgroups gmane.linux.keepalived.devel
Message-ID <[email protected]>
Hi Alexandre,


Examine global data today and found a memcpy missed null byte

Also data->router_id always set even null

/* Default settings */
static void
set_default_router_id(data_t * data)
{
         char *new_id = NULL;
         int len = 1; // for null char

         new_id = get_local_name();

         if (new_id && new_id[0])
         {

           len += strlen(new_id); // Add

           data->router_id = MALLOC(len); // Removed +1

           if (!data->router_id)          // memory error
                 return;
         }

// memcpy missing copy last char \0 fixed
// Allways copy even null

         memcpy(data->router_id, new_id, len);
}



cheers

-- 


/Jan Holmberg


------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.