Check correct attributes when loading service from blob
authorRafał Miłecki <rafal@milecki.pl>
Fri, 10 Feb 2017 13:48:36 +0000 (14:48 +0100)
committerRafał Miłecki <rafal@milecki.pl>
Fri, 10 Feb 2017 14:54:43 +0000 (15:54 +0100)
We access SERVICE_TXT so we should check for this entry. Checking
SERVICE_SERVICE doesn't make sense anyway as it's verified few lines
above (in the same funcion).

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Acked-by: John Crispin <john@phrozen.org>
service.c

index bb87aff954aa0cc7dd95f5a90ecd5a2b5a2b7daa..45b93459034c44c9234255916cb0f0f2b6ddaa56 100644 (file)
--- a/service.c
+++ b/service.c
@@ -229,7 +229,7 @@ service_load_blob(struct blob_attr *b)
        if (!_tb[SERVICE_PORT] || !_tb[SERVICE_SERVICE])
                return;
 
-       if (_tb[SERVICE_SERVICE])
+       if (_tb[SERVICE_TXT])
                blobmsg_for_each_attr(txt, _tb[SERVICE_TXT], rem2)
                        txt_len += 1 + strlen(blobmsg_get_string(txt));
 
@@ -248,7 +248,7 @@ service_load_blob(struct blob_attr *b)
        s->txt_len = txt_len;
        s->txt = d_txt;
 
-       if (_tb[SERVICE_SERVICE])
+       if (_tb[SERVICE_TXT])
                blobmsg_for_each_attr(txt, _tb[SERVICE_TXT], rem2) {
                        int len = strlen(blobmsg_get_string(txt));
                        if (!len)