PATCH: libsemanage-1.10.0
There is no advantage to using strnlen() over strlen() since buf is guaranteed to be a NUL-terminated string.
- todd
src/semanage_store.c +2 -2
@@ -968,14 +968,14 @@if (!strncmp (buf,"HOME_DIR" ,8 ) || !strncmp (buf,"HOME_ROOT" ,9 ) ||strstr (buf,"ROLE" )) {/* This contains one of the template variables, write it to homedir.template */ -if (write (hd, buf,strnlen (buf,PATH_MAX )) ==0 ) { +if (write (hd, buf,strlen (buf)) ==0 ) {ERR (sh,"Write to %s failed." ,semanage_path (SEMANAGE_TMP ,SEMANAGE_HOMEDIR_TMPL )); goto cleanup; } }else { -if (write (fc, buf,strnlen (buf,PATH_MAX )) ==0 ) { +if (write (fc, buf,strlen (buf)) ==0 ) {ERR (sh,"Write to %s failed." ,semanage_path (SEMANAGE_TMP ,SEMANAGE_FC )); goto cleanup;
--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
Stephen Smalley
AppliedQuoted 15 lines · On Wed, 2007-02-07 at 12:09 -0500, [email protected] wrote:
There is no advantage to using
strnlen()overstrlen()since buf is guaranteed to be a NUL-terminated string.- todd
src/semanage_store.c +1
-1@@ -968,14 +968,14 @@if (!strncmp (buf,"HOME_DIR" ,8 ) || !strncmp (buf,"HOME_ROOT" ,9 ) ||strstr (buf,"ROLE" )) {/* This contains one of the template variables, write it to homedir.template */ -if (write (hd, buf,strnlen (buf,PATH_MAX )) ==0 ) { +if (write (hd, buf,strlen (buf)) ==0 ) { ERR(sh, "Write to %s failed.",
src/semanage_store.c line 981
Quoted 10 lines
src/semanage_store.c +1
-1semanage_path (SEMANAGE_TMP , SEMANAGE_HOMEDIR_TMPL)); goto cleanup; } }else { -if (write (fc, buf,strnlen (buf,PATH_MAX )) ==0 ) { +if (write (fc, buf,strlen (buf)) ==0 ) {ERR (sh,"Write to %s failed." ,semanage_path (SEMANAGE_TMP ,SEMANAGE_FC )); goto cleanup;
Merged to -stable and to -trunk.
Signature · 8 lines
Stephen Smalley National Security Agency -- This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.