selinux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] libsepol: ibpkeys.c: fix printf format string specifiers for subnet_prefix
@ 2018-11-05 14:38 Stephen Smalley
  2018-11-05 20:55 ` Nicolas Iooss
  0 siblings, 1 reply; 3+ messages in thread
From: Stephen Smalley @ 2018-11-05 14:38 UTC (permalink / raw)
  To: selinux; +Cc: Stephen Smalley

Use PRIx64 to print the subnet_prefix (which is a uint64_t) instead
of lx.

Fixes https://github.com/SELinuxProject/selinux/issues/108

Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
---
 libsepol/src/ibpkeys.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/libsepol/src/ibpkeys.c b/libsepol/src/ibpkeys.c
index 682bf5db..68a9bdfe 100644
--- a/libsepol/src/ibpkeys.c
+++ b/libsepol/src/ibpkeys.c
@@ -1,5 +1,6 @@
 #include <netinet/in.h>
 #include <stdlib.h>
+#include <inttypes.h>
 
 #include "debug.h"
 #include "context.h"
@@ -176,7 +177,7 @@ int sepol_ibpkey_query(sepol_handle_t *handle,
 	return STATUS_SUCCESS;
 
 err:
-	ERR(handle, "could not query ibpkey subnet prefix: %#lx range %u - %u exists",
+	ERR(handle, "could not query ibpkey subnet prefix: %#" PRIx64 " range %u - %u exists",
 	    subnet_prefix, low, high);
 	return STATUS_ERR;
 }
@@ -203,7 +204,7 @@ int sepol_ibpkey_modify(sepol_handle_t *handle,
 	return STATUS_SUCCESS;
 
 err:
-	ERR(handle, "could not load ibpkey subnet prefix: %#lx range %u - %u exists",
+	ERR(handle, "could not load ibpkey subnet prefix: %#" PRIx64 " range %u - %u exists",
 	    subnet_prefix, low, high);
 	if (ibpkey) {
 		context_destroy(&ibpkey->context[0]);
-- 
2.19.1


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

* Re: [PATCH] libsepol: ibpkeys.c: fix printf format string specifiers for subnet_prefix
  2018-11-05 14:38 [PATCH] libsepol: ibpkeys.c: fix printf format string specifiers for subnet_prefix Stephen Smalley
@ 2018-11-05 20:55 ` Nicolas Iooss
  2018-11-23 21:08   ` Nicolas Iooss
  0 siblings, 1 reply; 3+ messages in thread
From: Nicolas Iooss @ 2018-11-05 20:55 UTC (permalink / raw)
  To: Stephen Smalley; +Cc: selinux

On Mon, Nov 5, 2018 at 3:36 PM Stephen Smalley <sds@tycho.nsa.gov> wrote:
>
> Use PRIx64 to print the subnet_prefix (which is a uint64_t) instead
> of lx.
>
> Fixes https://github.com/SELinuxProject/selinux/issues/108
>
> Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
> ---
>  libsepol/src/ibpkeys.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/libsepol/src/ibpkeys.c b/libsepol/src/ibpkeys.c
> index 682bf5db..68a9bdfe 100644
> --- a/libsepol/src/ibpkeys.c
> +++ b/libsepol/src/ibpkeys.c
> @@ -1,5 +1,6 @@
>  #include <netinet/in.h>
>  #include <stdlib.h>
> +#include <inttypes.h>
>
>  #include "debug.h"
>  #include "context.h"
> @@ -176,7 +177,7 @@ int sepol_ibpkey_query(sepol_handle_t *handle,
>         return STATUS_SUCCESS;
>
>  err:
> -       ERR(handle, "could not query ibpkey subnet prefix: %#lx range %u - %u exists",
> +       ERR(handle, "could not query ibpkey subnet prefix: %#" PRIx64 " range %u - %u exists",
>             subnet_prefix, low, high);
>         return STATUS_ERR;
>  }
> @@ -203,7 +204,7 @@ int sepol_ibpkey_modify(sepol_handle_t *handle,
>         return STATUS_SUCCESS;
>
>  err:
> -       ERR(handle, "could not load ibpkey subnet prefix: %#lx range %u - %u exists",
> +       ERR(handle, "could not load ibpkey subnet prefix: %#" PRIx64 " range %u - %u exists",
>             subnet_prefix, low, high);
>         if (ibpkey) {
>                 context_destroy(&ibpkey->context[0]);
> --
> 2.19.1
>

This looks good to me, and while testing some things, I found a
similar issue in libselinux/src/selinux_restorecon.c. Patch
incoming...

Cheers,
Nicolas


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

* Re: [PATCH] libsepol: ibpkeys.c: fix printf format string specifiers for subnet_prefix
  2018-11-05 20:55 ` Nicolas Iooss
@ 2018-11-23 21:08   ` Nicolas Iooss
  0 siblings, 0 replies; 3+ messages in thread
From: Nicolas Iooss @ 2018-11-23 21:08 UTC (permalink / raw)
  To: Stephen Smalley; +Cc: selinux

On Mon, Nov 5, 2018 at 9:55 PM Nicolas Iooss <nicolas.iooss@m4x.org> wrote:
>
> On Mon, Nov 5, 2018 at 3:36 PM Stephen Smalley <sds@tycho.nsa.gov> wrote:
> >
> > Use PRIx64 to print the subnet_prefix (which is a uint64_t) instead
> > of lx.
> >
> > Fixes https://github.com/SELinuxProject/selinux/issues/108
> >
> > Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
> > ---
> >  libsepol/src/ibpkeys.c | 5 +++--
> >  1 file changed, 3 insertions(+), 2 deletions(-)
> >
> > diff --git a/libsepol/src/ibpkeys.c b/libsepol/src/ibpkeys.c
> > index 682bf5db..68a9bdfe 100644
> > --- a/libsepol/src/ibpkeys.c
> > +++ b/libsepol/src/ibpkeys.c
> > @@ -1,5 +1,6 @@
> >  #include <netinet/in.h>
> >  #include <stdlib.h>
> > +#include <inttypes.h>
> >
> >  #include "debug.h"
> >  #include "context.h"
> > @@ -176,7 +177,7 @@ int sepol_ibpkey_query(sepol_handle_t *handle,
> >         return STATUS_SUCCESS;
> >
> >  err:
> > -       ERR(handle, "could not query ibpkey subnet prefix: %#lx range %u - %u exists",
> > +       ERR(handle, "could not query ibpkey subnet prefix: %#" PRIx64 " range %u - %u exists",
> >             subnet_prefix, low, high);
> >         return STATUS_ERR;
> >  }
> > @@ -203,7 +204,7 @@ int sepol_ibpkey_modify(sepol_handle_t *handle,
> >         return STATUS_SUCCESS;
> >
> >  err:
> > -       ERR(handle, "could not load ibpkey subnet prefix: %#lx range %u - %u exists",
> > +       ERR(handle, "could not load ibpkey subnet prefix: %#" PRIx64 " range %u - %u exists",
> >             subnet_prefix, low, high);
> >         if (ibpkey) {
> >                 context_destroy(&ibpkey->context[0]);
> > --
> > 2.19.1
> >
>
> This looks good to me, and while testing some things, I found a
> similar issue in libselinux/src/selinux_restorecon.c. Patch
> incoming...
>
> Cheers,
> Nicolas

Merged.

Nicolas


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

end of thread, other threads:[~2018-11-23 21:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-05 14:38 [PATCH] libsepol: ibpkeys.c: fix printf format string specifiers for subnet_prefix Stephen Smalley
2018-11-05 20:55 ` Nicolas Iooss
2018-11-23 21:08   ` Nicolas Iooss

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).