All of lore.kernel.org
 help / color / mirror / Atom feed
* PATCH: libsemanage-1.10.0
@ 2007-02-07 17:09 Todd.Miller
  2007-02-20 15:28 ` Stephen Smalley
  0 siblings, 1 reply; 2+ messages in thread
From: Todd.Miller @ 2007-02-07 17:09 UTC (permalink / raw)
  To: SE Linux

There is no advantage to using strnlen() over strlen() since buf is
guaranteed to be a NUL-terminated string.

 - todd

--- libsemanage-1.10.0/src/semanage_store.c	2007-01-08 16:20:17.000000000 -0500
+++ libsemanage-1.10.0/src/semanage_store.c	2007-02-06 17:04:41.000000000 -0500
@@ -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 majordomo@tycho.nsa.gov with
the words "unsubscribe selinux" without quotes as the message.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: PATCH: libsemanage-1.10.0
  2007-02-07 17:09 PATCH: libsemanage-1.10.0 Todd.Miller
@ 2007-02-20 15:28 ` Stephen Smalley
  0 siblings, 0 replies; 2+ messages in thread
From: Stephen Smalley @ 2007-02-20 15:28 UTC (permalink / raw)
  To: Todd.Miller; +Cc: SE Linux

On Wed, 2007-02-07 at 12:09 -0500, Todd.Miller@sparta.com wrote:
> There is no advantage to using strnlen() over strlen() since buf is
> guaranteed to be a NUL-terminated string.
> 
>  - todd
> 
> --- libsemanage-1.10.0/src/semanage_store.c	2007-01-08 16:20:17.000000000 -0500
> +++ libsemanage-1.10.0/src/semanage_store.c	2007-02-06 17:04:41.000000000 -0500
> @@ -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;
> 

Merged to -stable and to -trunk.

-- 
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 majordomo@tycho.nsa.gov with
the words "unsubscribe selinux" without quotes as the message.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-02-20 15:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-07 17:09 PATCH: libsemanage-1.10.0 Todd.Miller
2007-02-20 15:28 ` Stephen Smalley

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.