[SSSD] [PATCH] SUDO: realloc with sizeof(uint32_t) when adding uint32_t
Jakub Hrozek
jhrozek at redhat.com
Mon Jul 22 13:19:39 UTC 2013
On Mon, Jul 22, 2013 at 01:54:54PM +0200, Jakub Hrozek wrote:
> On Mon, Jul 22, 2013 at 12:20:22PM +0200, Lukas Slebodnik wrote:
> > On (22/07/13 11:01), Jakub Hrozek wrote:
> > >The sizeof seemed wrong to me.
> >
> > >From afa4a828ce7cece88870db93720508f3a7475351 Mon Sep 17 00:00:00 2001
> > >From: Jakub Hrozek <jhrozek at redhat.com>
> > >Date: Mon, 22 Jul 2013 09:56:45 +0200
> > >Subject: [PATCH] SUDO: realloc with sizeof(uint32_t) when adding uint32_t
> > >
> > >---
> > > src/responder/sudo/sudosrv_query.c | 2 +-
> > > 1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > >diff --git a/src/responder/sudo/sudosrv_query.c b/src/responder/sudo/sudosrv_query.c
> > >index d88d247264ccb440b5411cffceb8937f8483cb3f..c60202f5ef22f9ea9c0c6813135a1e62cf6b8bd9 100644
> > >--- a/src/responder/sudo/sudosrv_query.c
> > >+++ b/src/responder/sudo/sudosrv_query.c
> > >@@ -60,7 +60,7 @@ static int sudosrv_response_append_uint32(TALLOC_CTX *mem_ctx,
> > > uint8_t *response_body = *_response_body;
> > >
> > > response_body = talloc_realloc(mem_ctx, response_body, uint8_t,
> > >- response_len + sizeof(int));
> > >+ response_len + sizeof(uint32_t));
> > > if (response_body == NULL) {
> > > DEBUG(SSSDBG_CRIT_FAILURE, ("talloc_realloc() failed\n"));
> > > return ENOMEM;
> > >--
> > >1.8.3.1
> > >
> > sizeof(number) could also be used, but function has name
> > sudosrv_response_append_uint32. So I am fine with this patch.
> >
> > ACK
> >
> > LS
>
> It's probably just a personal preference, but I found the type name more
> readable in the sizeof() call.
>
> Pushed to master.
Also pushed to sssd-1-10
More information about the sssd-devel
mailing list