Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Coverity CID :198389]Memory - illegal accesses in /subsys/settings/src/settings_runtime.c #15991

Closed
aasthagr opened this issue May 7, 2019 · 1 comment · Fixed by #16056
Closed
Assignees
Labels
area: Settings Settings subsystem bug The issue is a bug, or the PR is fixing a bug Coverity A Coverity detected issue or its fix priority: medium Medium impact/importance bug

Comments

@aasthagr
Copy link
Collaborator

aasthagr commented May 7, 2019

Static code scan issues seen in File: /subsys/settings/src/settings_runtime.c
Category: Memory - illegal accesses
Function: settings_runtime_commit
Component: Other
CID: 198389
Please fix or provide comments to square it off in coverity in the link: https://scan9.coverity.com/reports.htm#v32951/p12996

@aasthagr aasthagr added area: Other bug The issue is a bug, or the PR is fixing a bug Coverity A Coverity detected issue or its fix labels May 7, 2019
@nashif
Copy link
Member

nashif commented May 8, 2019

*** CID 198389:  Memory - illegal accesses  (BUFFER_SIZE_WARNING)
/subsys/settings/src/settings_runtime.c: 58 in settings_runtime_commit()
52     {
53     	struct settings_handler *ch;
54     	char name1[SETTINGS_MAX_NAME_LEN + SETTINGS_EXTRA_LEN];
55     	char *name_argv[SETTINGS_MAX_DIR_DEPTH];
56     	int name_argc;
57     
>>>     CID 198389:  Memory - illegal accesses  (BUFFER_SIZE_WARNING)
>>>     Calling strncpy with a maximum size argument of 73 bytes on destination array "name1" of size 73 bytes might leave the destination string unterminated.
58     	strncpy(name1, name, sizeof(name1));
59     	ch = settings_parse_and_lookup(name1, &name_argc, name_argv);
60     	if (!ch) {
61     		return -EINVAL;
62     	}
63     	if (ch->h_commit) {


@aescolar aescolar added area: Settings Settings subsystem and removed area: Other labels May 8, 2019
@nashif nashif added the priority: medium Medium impact/importance bug label May 9, 2019
fnde-ot added a commit to fnde-ot/zephyr that referenced this issue May 10, 2019
This fixes some Coverity warnings.

Coverity-CID: 198391
Coverity-CID: 198390
Coverity-CID: 198389
Fixes zephyrproject-rtos#15989
Fixes zephyrproject-rtos#15990
Fixes zephyrproject-rtos#15991

Signed-off-by: François Delawarde <fnde@oticon.com>
nashif pushed a commit that referenced this issue May 10, 2019
This fixes some Coverity warnings.

Coverity-CID: 198391
Coverity-CID: 198390
Coverity-CID: 198389
Fixes #15989
Fixes #15990
Fixes #15991

Signed-off-by: François Delawarde <fnde@oticon.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Settings Settings subsystem bug The issue is a bug, or the PR is fixing a bug Coverity A Coverity detected issue or its fix priority: medium Medium impact/importance bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants