mirror of
https://github.com/alsa-project/alsa-utils
synced 2024-12-23 08:06:36 +01:00
fix warning: ‘strndup’ specified bound 4096 exceeds source size 2 [-Wstringop-overread]
In function ‘allocate_paths’, inlined from ‘xfer_options_parse_args’ at xfer-options.c:388:8: xfer-options.c:69:34: warning: ‘strndup’ specified bound 4096 exceeds source size 2 [-Wstringop-overread] 69 | xfer->paths[0] = strndup("-", PATH_MAX); | ^~~~~~~~~~~~~~~~~~~~~~
This commit is contained in:
parent
b399fb85a9
commit
041c190799
1 changed files with 2 additions and 2 deletions
|
@ -66,12 +66,12 @@ static int allocate_paths(struct xfer_context *xfer, char *const *paths,
|
||||||
xfer->path_count = count;
|
xfer->path_count = count;
|
||||||
|
|
||||||
if (stdio) {
|
if (stdio) {
|
||||||
xfer->paths[0] = strndup("-", PATH_MAX);
|
xfer->paths[0] = strndup("-", strlen("-"));
|
||||||
if (xfer->paths[0] == NULL)
|
if (xfer->paths[0] == NULL)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
} else {
|
} else {
|
||||||
for (i = 0; i < count; ++i) {
|
for (i = 0; i < count; ++i) {
|
||||||
xfer->paths[i] = strndup(paths[i], PATH_MAX);
|
xfer->paths[i] = strndup(paths[i], strlen(paths[i]));
|
||||||
if (xfer->paths[i] == NULL)
|
if (xfer->paths[i] == NULL)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue