From: Naina Nalluri Date: Tue, 3 May 2016 21:09:53 +0000 (-0700) Subject: ril: Fix kw issues X-Git-Tag: android-x86-8.1-r3~184 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=2be38acc92b5fcd52b72fa92a844f4da4d2d692d;p=android-x86%2Fhardware-ril.git ril: Fix kw issues Fix kw issues Import of partner fix 597883 Change-Id: I21ff028d07bf12d9aff232aeafbb01ec8d019c2a --- diff --git a/libril/RilSapSocket.cpp b/libril/RilSapSocket.cpp index 19457f4..4286ae4 100644 --- a/libril/RilSapSocket.cpp +++ b/libril/RilSapSocket.cpp @@ -248,7 +248,7 @@ void log_hex(const char *who, const uint8_t *buffer, int length) { int per_line = 0; do { - dest += sprintf(out, "%8.8s [%8.8x] ", who, source); + dest += snprintf(out, sizeof(out), "%8.8s [%8.8x] ", who, source); for(; source < length && dest_len - dest > 3 && per_line < BYTES_PER_LINE; source++, per_line ++) { out[dest++] = HEX_HIGH(buffer[source]); diff --git a/reference-ril/reference-ril.c b/reference-ril/reference-ril.c index b9baef1..557109b 100644 --- a/reference-ril/reference-ril.c +++ b/reference-ril/reference-ril.c @@ -532,23 +532,27 @@ static void requestOrSendDataCallList(RIL_Token *t) err = at_tok_nextstr(&line, &out); if (err < 0) goto error; - responses[i].type = alloca(strlen(out) + 1); - strcpy(responses[i].type, out); + + int type_size = strlen(out) + 1; + responses[i].type = alloca(type_size); + strlcpy(responses[i].type, out, type_size); // APN ignored for v5 err = at_tok_nextstr(&line, &out); if (err < 0) goto error; - responses[i].ifname = alloca(strlen(PPP_TTY_PATH) + 1); - strcpy(responses[i].ifname, PPP_TTY_PATH); + int ifname_size = strlen(PPP_TTY_PATH) + 1; + responses[i].ifname = alloca(ifname_size); + strlcpy(responses[i].ifname, PPP_TTY_PATH, ifname_size); err = at_tok_nextstr(&line, &out); if (err < 0) goto error; - responses[i].addresses = alloca(strlen(out) + 1); - strcpy(responses[i].addresses, out); + int addresses_size = strlen(out) + 1; + responses[i].addresses = alloca(addresses_size); + strlcpy(responses[i].addresses, out, addresses_size); { char propValue[PROP_VALUE_MAX];