platform_external_selinux/policycoreutils/sestatus
Eric Paris 5c0d7113de policycoreutils: sestatus: rewrite to shut up coverity
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>
2013-02-05 20:21:51 -05:00
..
Makefile policycoreutils: sestatus: Updated sestatus and man pages. 2011-12-05 16:10:38 -05:00
sestatus.8 policycoreutils: sestatus: Updated sestatus and man pages. 2011-12-05 16:10:38 -05:00
sestatus.c policycoreutils: sestatus: rewrite to shut up coverity 2013-02-05 20:21:51 -05:00
sestatus.conf initial import from svn trunk revision 2950 2008-08-19 15:30:36 -04:00
sestatus.conf.5 policycoreutils: sestatus: Updated sestatus and man pages. 2011-12-05 16:10:38 -05:00