Re: One byte low in memcopy in set_def ault_router_id
jan <[email protected]>
| Newsgroups | gmane.linux.keepalived.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi, write first msg to fast...
2015-05-07 21:59 skrev jan:
> Hi Alexandre,
>
>
> Examine global data today and found a memcpy missed null byte
>
> Also data->router_id always set even null
Reason possibly to change router_id to "" or not only to "some_text"
Must be able to set zero name with a api ??
>
> /* 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)
> {
>
> len += strlen(new_id); // Add
>
> data->router_id = MALLOC(len); // Removed +1
>
> if (!data->router_id) // memory error
> return;
} else
{
data->router_id = MALLOC(len);
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
> _______________________________________________
> Keepalived-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/keepalived-devel
--
mvh
/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