2011-06-21 08:34:05

by Lukasz Rymanowski

[permalink] [raw]
Subject: [PATCH] Fix SAP message padding macro

With this patch it is not possible to have
incorrect padding equal to 4.
---
sap/server.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/sap/server.c b/sap/server.c
index 011faa6..c55aa6e 100644
--- a/sap/server.c
+++ b/sap/server.c
@@ -49,7 +49,7 @@
#define SAP_UUID "0000112D-0000-1000-8000-00805F9B34FB"
#define SAP_SERVER_CHANNEL 8

-#define PADDING4(x) (4 - (x & 0x03))
+#define PADDING4(x) ((4 - (x & 0x03)) & 0x03)
#define PARAMETER_SIZE(x) (sizeof(struct sap_parameter) + x + PADDING4(x))

#define SAP_NO_REQ 0xFF
--
on behalf of ST-Ericsson



2011-06-28 07:51:53

by Johan Hedberg

[permalink] [raw]
Subject: Re: [PATCH] Fix SAP message padding macro

Hi Lukasz,

On Tue, Jun 21, 2011, Lukasz Rymanowski wrote:
> With this patch it is not possible to have incorrect padding equal to 4.
> ---
> sap/server.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)

Applied. Thanks.

Johan