[libvirt] [PATCH 2/4] Don't check validity of missing attributes in DNS SRV XML

Michal Privoznik mprivozn at redhat.com
Fri Jul 26 10:44:13 UTC 2013


On 26.07.2013 12:28, Ján Tomko wrote:
> This fixes a crash if one of them is missing.
> 
> https://bugzilla.redhat.com/show_bug.cgi?id=988718
> ---
>  src/conf/network_conf.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c
> index e3e0e89..5faac92 100644
> --- a/src/conf/network_conf.c
> +++ b/src/conf/network_conf.c
> @@ -923,7 +923,7 @@ virNetworkDNSSrvDefParseXML(const char *networkName,
>                           " of network %s"), networkName);
>          goto error;
>      }
> -    if (strlen(def->service) > DNS_RECORD_LENGTH_SRV) {
> +    if (def->service && strlen(def->service) > DNS_RECORD_LENGTH_SRV) {
>          virReportError(VIR_ERR_XML_DETAIL,
>                         _("Service name '%s' in network %s is too long, limit is %d bytes"),
>                         def->service, networkName, DNS_RECORD_LENGTH_SRV);
> @@ -939,7 +939,8 @@ virNetworkDNSSrvDefParseXML(const char *networkName,
>      }
>  
>      /* Check whether protocol value is the supported one */
> -    if (STRNEQ(def->protocol, "tcp") && (STRNEQ(def->protocol, "udp"))) {
> +    if (def->protocol && STRNEQ(def->protocol, "tcp") &&
> +        (STRNEQ(def->protocol, "udp"))) {
>          virReportError(VIR_ERR_XML_DETAIL,
>                         _("Invalid protocol attribute value '%s' "
>                           " in DNS SRV record of network %s"),
> 

ACK

Michal




More information about the libvir-list mailing list