diff options
author | 2017-08-22 18:32:34 -0400 | |
---|---|---|
committer | 2017-08-23 05:10:42 +0000 | |
commit | cfc997ef3da9f406afe5caad99fc98a53aab7a77 (patch) | |
tree | 5d4d6ed69289c17d4202dbbc230184bd0280b980 /src/vlibmemory/memory_shared.c | |
parent | c900ccc34ca74f30cc3bee621c54954c02be36ff (diff) |
Fix vl_map_shmem() root_path dangling reference.
Change-Id: I90c9d8e151cacf50a99ce76b7a589079303196e8
Signed-off-by: Dave Wallace <dwallacelf@gmail.com>
Diffstat (limited to 'src/vlibmemory/memory_shared.c')
-rw-r--r-- | src/vlibmemory/memory_shared.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/vlibmemory/memory_shared.c b/src/vlibmemory/memory_shared.c index fbdabd06..8c646908 100644 --- a/src/vlibmemory/memory_shared.c +++ b/src/vlibmemory/memory_shared.c @@ -340,15 +340,18 @@ vl_map_shmem (const char *region_name, int is_vlib) int i, rv; struct timespec ts, tsrem; u32 vlib_input_queue_length; + char *vpe_api_region_suffix = "-vpe-api"; memset (a, 0, sizeof (*a)); - if (strstr (region_name, "-vpe-api")) + if (strstr (region_name, vpe_api_region_suffix)) { - char root_path[strlen (region_name)]; - strncpy (root_path, region_name, strlen (region_name) - 8); - a->root_path = root_path; - am->root_path = root_path; + u8 *root_path = format (0, "%s", region_name); + _vec_len (root_path) = (vec_len (root_path) - + strlen (vpe_api_region_suffix)); + vec_terminate_c_string (root_path); + a->root_path = (const char *) root_path; + am->root_path = (const char *) root_path; } if (is_vlib == 0) |