vhost: check the strlen of basename
Change-Id: I0f0eb7edbec71609754a4cda80c578b75c84c87f Signed-off-by: Ziye Yang <ziye.yang@intel.com>
This commit is contained in:
parent
fa9d3466aa
commit
e439020961
@ -1127,10 +1127,11 @@ spdk_vhost_startup(void *arg1, void *arg2)
|
||||
pthread_t tid;
|
||||
const char *basename = arg1;
|
||||
|
||||
if (basename) {
|
||||
if (basename && strlen(basename) > 0) {
|
||||
ret = snprintf(dev_dirname, sizeof(dev_dirname) - 2, "%s", basename);
|
||||
if ((size_t)ret >= sizeof(dev_dirname) - 2)
|
||||
if ((size_t)ret >= sizeof(dev_dirname) - 2) {
|
||||
rte_exit(EXIT_FAILURE, "Char dev dir path length %d is too long\n", ret);
|
||||
}
|
||||
|
||||
if (dev_dirname[ret - 1] != '/') {
|
||||
dev_dirname[ret] = '/';
|
||||
|
Loading…
x
Reference in New Issue
Block a user