From ea33b0966b91c5fb4db1294a4a21395af27ca081 Mon Sep 17 00:00:00 2001 From: Anis Ellouze Date: Tue, 19 Apr 2016 17:04:55 +0100 Subject: [PATCH] Ticket #8946 : fix add object seg fault issue --- dm/dmcwmp.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/dm/dmcwmp.c b/dm/dmcwmp.c index 75a60d2..6743831 100644 --- a/dm/dmcwmp.c +++ b/dm/dmcwmp.c @@ -487,7 +487,11 @@ int update_param_instance_alias(struct dmctx *ctx, char *param, char **new_param char *dup = dmstrdup(param); p = buf; for (pch = strtok_r(dup, ".", &spch); pch != NULL; pch = strtok_r(NULL, ".", &spch)) { - if (pch[0]== '[' || isdigit(pch[0])) { + if (isdigit(pch[0])) { + dmstrappendchr(p, '.'); + dmstrappendstr(p, pch); + i++; + } else if (pch[0]== '[') { dmstrappendchr(p, '.'); dmstrappendstr(p, ctx->inst_buf[i]); i++; @@ -502,6 +506,8 @@ int update_param_instance_alias(struct dmctx *ctx, char *param, char **new_param } } } + if (param[strlen(param)-1] == '.') + dmstrappendchr(p, '.'); dmstrappendend(p); *new_param = dmstrdup(buf); dmfree(dup);