drv_define() doesn't check the length of IF's name, so the IF's name may be trancated to maxium length(IFNAMSIZ - 1).
Signed-off-by: jmiao <jm...@redhat.com> --- AUTHORS | 3 ++- src/drv_debian.c | 3 +++ src/drv_redhat.c | 3 +++ src/drv_suse.c | 3 +++ 4 files changed, 11 insertions(+), 1 deletion(-) diff --git a/AUTHORS b/AUTHORS index 6188570..bee6abe 100644 --- a/AUTHORS +++ b/AUTHORS @@ -21,4 +21,5 @@ Contributions by: Hendrik Schwartke <hend...@os-t.de> Ting Liu <b28...@freescale.com> Satoru SATOH <ss...@redhat.com> - Martin Wilck <martin.wi...@ts.fujitsu.com> \ No newline at end of file + Martin Wilck <martin.wi...@ts.fujitsu.com> + Jincheng Miao <jm...@redhat.com> diff --git a/src/drv_debian.c b/src/drv_debian.c index def0c0e..342777c 100644 --- a/src/drv_debian.c +++ b/src/drv_debian.c @@ -925,6 +925,9 @@ struct netcf_if *drv_define(struct netcf *ncf, const char *xml_str) { name = device_name_from_xml(ncf, ncf_xml); ERR_COND_BAIL(name == NULL, ncf, EINTERNAL); + ERR_THROW(strlen(name) >= IFNAMSIZ, ncf, EINTERNAL, + "The interface name '%s' exceeds the maximum length: %d", + name, IFNAMSIZ - 1); rm_all_interfaces(ncf, ncf_xml); ERR_BAIL(ncf); diff --git a/src/drv_redhat.c b/src/drv_redhat.c index 3697473..c40d7fb 100644 --- a/src/drv_redhat.c +++ b/src/drv_redhat.c @@ -878,6 +878,9 @@ struct netcf_if *drv_define(struct netcf *ncf, const char *xml_str) { name = device_name_from_xml(ncf, ncf_xml); ERR_COND_BAIL(name == NULL, ncf, EINTERNAL); + ERR_THROW(strlen(name) >= IFNAMSIZ, ncf, EINTERNAL, + "The interface name '%s' exceeds the maximum length: %d", + name, IFNAMSIZ - 1); rm_all_interfaces(ncf, ncf_xml); ERR_BAIL(ncf); diff --git a/src/drv_suse.c b/src/drv_suse.c index 666d802..782d366 100644 --- a/src/drv_suse.c +++ b/src/drv_suse.c @@ -1020,6 +1020,9 @@ struct netcf_if *drv_define(struct netcf *ncf, const char *xml_str) { name = device_name_from_xml(ncf, ncf_xml); ERR_COND_BAIL(name == NULL, ncf, EINTERNAL); + ERR_THROW(strlen(name) >= IFNAMSIZ, ncf, EINTERNAL, + "The interface name '%s' exceeds the maximum length: %d", + name, IFNAMSIZ - 1); rm_all_interfaces(ncf, ncf_xml); ERR_BAIL(ncf); -- 1.8.2.1 _______________________________________________ netcf-devel mailing list netcf-devel@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/netcf-devel