From: Denis Kenzior Date: Tue, 1 Dec 2009 22:05:20 +0000 (-0600) Subject: Fix: Make sure we don't overflow the buffer X-Git-Tag: 0.12~10 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=184eb91aa63f85ccb5df02e1d41cae1a5c8e67db;p=platform%2Fupstream%2Fofono.git Fix: Make sure we don't overflow the buffer --- diff --git a/drivers/hsomodem/gprs-context.c b/drivers/hsomodem/gprs-context.c index b433bf1..4aa7970 100644 --- a/drivers/hsomodem/gprs-context.c +++ b/drivers/hsomodem/gprs-context.c @@ -44,6 +44,9 @@ #define HSO_CONNECTING 2 #define HSO_FAILED 3 +#define AUTH_BUF_LENGTH OFONO_GPRS_MAX_USERNAME_LENGTH + \ + OFONO_GPRS_MAX_PASSWORD_LENGTH + 128 + static const char *none_prefix[] = { NULL }; static const char *owandata_prefix[] = { "_OWANDATA:", NULL }; @@ -151,7 +154,7 @@ static void hso_gprs_activate_primary(struct ofono_gprs_context *gc, { struct gprs_context_data *gcd = ofono_gprs_context_get_data(gc); struct cb_data *cbd = cb_data_new(cb, data); - char buf[OFONO_GPRS_MAX_APN_LENGTH + 128]; + char buf[AUTH_BUF_LENGTH]; int len; if (!cbd) diff --git a/drivers/mbmmodem/gprs-context.c b/drivers/mbmmodem/gprs-context.c index 778d3bf..f3f8926 100644 --- a/drivers/mbmmodem/gprs-context.c +++ b/drivers/mbmmodem/gprs-context.c @@ -43,6 +43,9 @@ #define MBM_E2NAP_CONNECTED 1 #define MBM_E2NAP_CONNECTING 2 +#define AUTH_BUF_LENGTH OFONO_GPRS_MAX_USERNAME_LENGTH + \ + OFONO_GPRS_MAX_PASSWORD_LENGTH + 128 + static const char *none_prefix[] = { NULL }; struct gprs_context_data { @@ -132,7 +135,7 @@ static void mbm_gprs_activate_primary(struct ofono_gprs_context *gc, { struct gprs_context_data *gcd = ofono_gprs_context_get_data(gc); struct cb_data *cbd = cb_data_new(cb, data); - char buf[OFONO_GPRS_MAX_APN_LENGTH + 128]; + char buf[AUTH_BUF_LENGTH]; int len; if (!cbd)