From: Chris Tallon Date: Sun, 12 Mar 2006 17:26:44 +0000 (+0000) Subject: segfault fix on no recording summary X-Git-Tag: r0-2-5~24 X-Git-Url: https://git.vomp.tv/gitweb/?a=commitdiff_plain;h=d14703d8134e55ae817aae557c8afa1833a5bed9;p=vompserver.git segfault fix on no recording summary --- diff --git a/mvpclient.c b/mvpclient.c index 0802127..fe2a898 100644 --- a/mvpclient.c +++ b/mvpclient.c @@ -361,8 +361,8 @@ int MVPClient::processGetSummary(UCHAR* data, int length) { UCHAR* sendBuffer = new UCHAR[50000]; // hope this is enough int count = 4; // leave space for the packet length - char* point; + #if VDRVERSNUM < 10300 point = (char*)recording->Summary(); #else @@ -375,8 +375,18 @@ int MVPClient::processGetSummary(UCHAR* data, int length) log->log("Client", Log::DEBUG, "description pointer %p", point); } #endif - strcpy((char*)&sendBuffer[count], point); - count += strlen(point) + 1; + + if (point) + { + strcpy((char*)&sendBuffer[count], point); + count += strlen(point) + 1; + } + else + { + strcpy((char*)&sendBuffer[count], ""); + count += 1; + } + *(ULONG*)&sendBuffer[0] = htonl(count - 4); // -4 : take off the size field log->log("Client", Log::DEBUG, "recorded size as %u", ntohl(*(ULONG*)&sendBuffer[0]));