aboutsummaryrefslogtreecommitdiffstats
path: root/include/osmocom/gsm
diff options
context:
space:
mode:
authorJacob Erlbeck <jerlbeck@sysmocom.de>2014-01-07 13:39:24 +0100
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2014-01-09 08:22:14 +0100
commit26cbd459fcc7cd7bed8256a5ad078c177a7a7fe2 (patch)
tree0de9217e0d73edd48d3a175680a6824ffd2c77ea /include/osmocom/gsm
parentd4d87c5427bdf838cbfc3948bcf035e1e4036fd9 (diff)
sms: Fix gsm_7bit legacy functions return value
The legacy 7bit conversion functions (those without the '_n_' in the name) gave wrong return values on 64 bit platforms due to unproper signed/unsigned conversions and the usage of SIZE_MAX. This patch fixes this by using a smaller max size (see GSM_7BIT_LEGACY_MAX_BUFFER_SIZE, currently set to 64k) for the legacy wrappers and by using unsigned int for max_septets. In addition, there are tests now that check the return values of legacy encoding and decoding. Sponsored-by: On-Waves ehf
Diffstat (limited to 'include/osmocom/gsm')
-rw-r--r--include/osmocom/gsm/gsm_utils.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/include/osmocom/gsm/gsm_utils.h b/include/osmocom/gsm/gsm_utils.h
index f412e3e6..02bfe4cb 100644
--- a/include/osmocom/gsm/gsm_utils.h
+++ b/include/osmocom/gsm/gsm_utils.h
@@ -195,6 +195,9 @@ enum gsm_chan_t {
};
/* Deprectated functions */
+/* Limit encoding and decoding to use no more than this amount of buffer bytes */
+#define GSM_7BIT_LEGACY_MAX_BUFFER_SIZE 0x10000
+
int gsm_7bit_decode(char *decoded, const uint8_t *user_data, uint8_t length) OSMO_DEPRECATED("Use gsm_7bit_decode_n() instead");
int gsm_7bit_decode_ussd(char *decoded, const uint8_t *user_data, uint8_t length) OSMO_DEPRECATED("Use gsm_7bit_decode_n_ussd() instead");
int gsm_7bit_encode(uint8_t *result, const char *data) OSMO_DEPRECATED("Use gsm_7bit_encode_n() instead");