Skip to content

Convert from strlen to strnlen where appropriate #808

@skliper

Description

@skliper

Is your feature request related to a problem? Please describe.
Per security standards strlen should be avoided if possible:

src/os/vxworks/src/os-impl-shell.c:        OS_write(fdCmd, Cmd, strlen(Cmd));
src/os/vxworks/src/os-impl-symtab.c:    if (strlen(name) >= OS_MAX_SYM_LEN)
src/os/shared/src/osapi-sockets.c:        len = strlen(sock->stream_name);
src/os/shared/src/osapi-sockets.c:        len = strlen(sock->stream_name);
src/os/shared/src/osapi-idmap.c:            name_len = strlen(record->name_entry);
src/os/shared/src/osapi-filesys.c:    mplen = strlen(filesys->virtual_mountpt);
src/os/shared/src/osapi-filesys.c:    if (strlen(dev_name) >= OS_FS_DEV_NAME_LEN)
src/os/shared/src/osapi-filesys.c:    VirtPathLen = strlen(VirtualPath);
src/os/shared/src/osapi-filesys.c:    if (strlen(name_ptr) >= OS_MAX_FILE_NAME)
src/os/shared/src/osapi-filesys.c:            SysMountPointLen = strlen(filesys->system_mountpt);
src/os/shared/src/osapi-filesys.c:            VirtPathBegin    = strlen(filesys->virtual_mountpt);

Describe the solution you'd like
Replace with strnlen where possible.

Describe alternatives you've considered
None

Additional context
Security analysis warning

Requester Info
Jacob Hageman - NASA/GSFC

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions