Richard W.M. Jones
2009-Sep-17 13:58 UTC
[Libguestfs] [PATCH] 'len' should be an unsigned 32 bit int.
-- Richard Jones, Emerging Technologies, Red Hat http://et.redhat.com/~rjones libguestfs lets you edit virtual machines. Supports shell scripting, bindings from many languages. http://et.redhat.com/~rjones/libguestfs/ See what it can do: http://et.redhat.com/~rjones/libguestfs/recipes.html -------------- next part -------------->From 4d86861feb312fda6d366e2bd067bcc58470c1e0 Mon Sep 17 00:00:00 2001From: Richard Jones <rjones at trick.home.annexia.org> Date: Thu, 17 Sep 2009 14:49:06 +0100 Subject: [PATCH 2/5] 'len' should be an unsigned 32 bit int. This only happened to work by accident before because 'unsigned len' happens to be 32 bit on all platforms we support. --- daemon/proto.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/daemon/proto.c b/daemon/proto.c index d935ded..431f219 100644 --- a/daemon/proto.c +++ b/daemon/proto.c @@ -45,7 +45,7 @@ main_loop (int _sock) XDR xdr; char *buf; char lenbuf[4]; - unsigned len; + uint32_t len; struct guestfs_message_header hdr; struct timeval start_t, end_t; int64_t start_us, end_us, elapsed_us; -- 1.6.2.5
Jim Meyering
2009-Sep-17 14:26 UTC
[Libguestfs] [PATCH] 'len' should be an unsigned 32 bit int.
Richard W.M. Jones wrote:>>From 4d86861feb312fda6d366e2bd067bcc58470c1e0 Mon Sep 17 00:00:00 2001 > From: Richard Jones <rjones at trick.home.annexia.org> > Date: Thu, 17 Sep 2009 14:49:06 +0100 > Subject: [PATCH 2/5] 'len' should be an unsigned 32 bit int. > > This only happened to work by accident before because 'unsigned len' > happens to be 32 bit on all platforms we support. > --- > daemon/proto.c | 2 +- > 1 files changed, 1 insertions(+), 1 deletions(-) > > diff --git a/daemon/proto.c b/daemon/proto.c > index d935ded..431f219 100644 > --- a/daemon/proto.c > +++ b/daemon/proto.c > @@ -45,7 +45,7 @@ main_loop (int _sock) > XDR xdr; > char *buf; > char lenbuf[4]; > - unsigned len; > + uint32_t len;Good one. ACK It'd be good to find any others like that, and to add automatic syntax-style check. I think it'd be pretty easy to do with coccinelle. http://coccinelle.lip6.fr/
Reasonably Related Threads
- [PATCH] daemon/Win32: Use xdr_u_int for PortableXDR compatibility.
- Re: guestfsd crashes when the handle is closed
- [PATCH] daemon: proto: Remove pervasive but useless debugging messages.
- [PATCH] Fix sizeof in jpake_free()
- Re: guestfsd crashes when the handle is closed