diff --git a/system/nxinit/service.c b/system/nxinit/service.c index 0d39bb614..3f7578fea 100644 --- a/system/nxinit/service.c +++ b/system/nxinit/service.c @@ -224,6 +224,7 @@ static int option_class(FAR struct service_manager_s *sm, return -errno; } + len = (len >= MAX_NXINIT_SERVICE_NAME) ? MAX_NXINIT_SERVICE_NAME : len; memcpy(c->name, argv[1], len); list_add_tail(&s->classes, &c->node); return 0; diff --git a/system/nxinit/service.h b/system/nxinit/service.h index d76406e56..babf6edd2 100644 --- a/system/nxinit/service.h +++ b/system/nxinit/service.h @@ -66,6 +66,8 @@ #define SVC_REMOVE (1 << 31) +#define MAX_NXINIT_SERVICE_NAME 32 + /**************************************************************************** * Public Types ****************************************************************************/ @@ -73,7 +75,7 @@ struct service_class_s { struct list_node node; /* Service class list node */ - FAR char name[0]; + FAR char name[MAX_NXINIT_SERVICE_NAME]; }; struct service_s