examples/vhost: check argument length
Add args length check before copying to fix the coverity issue. Coverity issue: 363741 Fixes: 3a04ecb21420 ("examples/vhost: add async vhost args parsing") Signed-off-by: Cheng Jiang <cheng1.jiang@intel.com> Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
This commit is contained in:
parent
7dd0d9f29f
commit
2b7126f5fc
@ -634,6 +634,12 @@ us_vhost_parse_args(int argc, char **argv)
|
||||
|
||||
if (!strncmp(long_option[option_index].name,
|
||||
"dma-type", MAX_LONG_OPT_SZ)) {
|
||||
if (strlen(optarg) >= MAX_LONG_OPT_SZ) {
|
||||
RTE_LOG(INFO, VHOST_CONFIG,
|
||||
"Wrong DMA type\n");
|
||||
us_vhost_usage(prgname);
|
||||
return -1;
|
||||
}
|
||||
strcpy(dma_type, optarg);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user