mirror of
https://github.com/SELinuxProject/selinux
synced 2025-01-16 02:10:55 +00:00
5c0d7113de
The code did: len = strlen(string); new_string = malloc(len); strncpy(new_string, string, len - 1) Which is perfectly legal, but it pissed off coverity because 99/100 times if you do new_string = malloc(strlen(string)) you are doing it wrong (you didn't leave room for the nul). I rewrote that area to just use strdup and then to blank out the last character with a nul. It's clear what's going on and nothing looks 'tricky'. It does cost us 1 byte of heap allocation. I think we can live with that to have safer looking string handling code. Signed-off-by: Eric Paris <eparis@redhat.com> |
||
---|---|---|
checkpolicy | ||
libselinux | ||
libsemanage | ||
libsepol | ||
policycoreutils | ||
scripts | ||
sepolgen | ||
.gitignore | ||
Makefile |