BUFSIZ is replaced with payload_size 45/38945/1 submit/tizen/20150511.111918 submit/tizen_mobile/20150511.124012 submit/tizen_mobile/20150512.042012
authorSung-jae Park <nicesj.park@samsung.com>
Fri, 1 May 2015 07:45:14 +0000 (16:45 +0900)
committerSung-jae Park <nicesj.park@samsung.com>
Fri, 1 May 2015 07:45:14 +0000 (16:45 +0900)
At least now, while I make a product using this code.
There is no such problem what I read from history in Tizen 3.0.
If the crash occurred when allocating heap more large size than BUFSIZ,
It mean somewhere else is broken.

It could be caller of this function.

The problem should be invetigated again.

If you really think that the problem is caused by this.
Please let me know it. contact to me.
We need discuss it.

[model] Redwood,Kiran,B3(Wearable)
[binary_type] AP
[customer] Docomo/Orange/ATT/Open
[issue#] N/A
[problem]
[cause]
[solution]
[team] HomeTF
[request]
[horizontal_expansion]

Change-Id: I3b3c46b7c023a5805a4bb63081049e9a534e9ecc

src/packet.c

index edf3158..ffdca79 100644 (file)
@@ -337,7 +337,7 @@ EAPI struct packet *packet_create_reply(const struct packet *packet, const char
 
        payload_size = sizeof(*result->data) + BUFSIZ;
        result->refcnt = 0;
-       result->data = calloc(1, BUFSIZ);
+       result->data = calloc(1, payload_size);
        if (!result->data) {
                ErrPrint("Heap: %s\n", strerror(errno));
                result->state = INVALID;
@@ -406,7 +406,7 @@ EAPI struct packet *packet_create(const char *cmd, const char *fmt, ...)
 
        payload_size = sizeof(*packet->data) + BUFSIZ;
        packet->refcnt = 0;
-       packet->data = calloc(1, BUFSIZ);
+       packet->data = calloc(1, payload_size);
        if (!packet->data) {
                ErrPrint("Heap: %s\n", strerror(errno));
                packet->state = INVALID;
@@ -459,7 +459,7 @@ EAPI struct packet *packet_create_noack(const char *cmd, const char *fmt, ...)
 
        payload_size = sizeof(*result->data) + BUFSIZ;
        result->refcnt = 0;
-       result->data = calloc(1, BUFSIZ);
+       result->data = calloc(1, payload_size);
        if (!result->data) {
                ErrPrint("Heap: %s\n", strerror(errno));
                result->state = INVALID;