aboutsummaryrefslogtreecommitdiffstats
path: root/sap
diff options
context:
space:
mode:
authorSzymon Janc <szymon.janc@tieto.com>2012-03-02 15:58:36 +0100
committerJohan Hedberg <johan.hedberg@intel.com>2012-03-02 14:38:06 -0800
commit097f46d93dab8336a9c70e1f12a12aa8c97cc2db (patch)
tree7a94500501bc93626c39cb623d7f122561a4de2d /sap
parent7cfcd11a958f785dcb7bd053b19972df7ef10336 (diff)
downloadbluez-097f46d93dab8336a9c70e1f12a12aa8c97cc2db.tar.gz
bluez-097f46d93dab8336a9c70e1f12a12aa8c97cc2db.tar.xz
bluez-097f46d93dab8336a9c70e1f12a12aa8c97cc2db.zip
SAP: Make PADDING4 macro a bit more robust
Bitwise operations are done before arithmetic operations and this might cause undesired results if macro is called with parameter of form x+y.
Diffstat (limited to 'sap')
-rw-r--r--sap/server.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/sap/server.c b/sap/server.c
index b8aa8a5c..b5abd70f 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)) & 0x03)
+#define PADDING4(x) ((4 - ((x) & 0x03)) & 0x03)
#define PARAMETER_SIZE(x) (sizeof(struct sap_parameter) + x + PADDING4(x))
#define SAP_NO_REQ 0xFF