Addressed and patch regenerated On Thu, 2018-08-23 at 21:57 +0200, Marcel Holtmann wrote: > Hi Brian, > > > Fixed compiler flagged unsafe usage of strncpy > > --- > > mesh/storage.c | 14 ++++++++------ > > 1 file changed, 8 insertions(+), 6 deletions(-) > > > > diff --git a/mesh/storage.c b/mesh/storage.c > > index 85fa81dda..1be403297 100644 > > --- a/mesh/storage.c > > +++ b/mesh/storage.c > > @@ -298,13 +298,14 @@ bool storage_parse_config(struct mesh_net *net, const char *config_name) > > result = parse_config(net, config_name, false); > > > > if (!result) { > > - char *bak = (char *) l_malloc(strlen(config_name) + 5); > > + size_t len = strlen(config_name) + 5; > > + char *bak = (char *) l_malloc(len); > > The (char *) cast is utterly pointless since l_malloc return void *. > > > > > if (!bak) > > goto done; > > So why are we still doing? l_malloc will abort if no memory can be allocated. We need to stop dealing with > memory allocation error handling. If you need that large memory then malloc should be used. If you use > l_malloc then expect the daemon might be killed. Which is fine systemd can restart it. > > Regards > > Marcel >