From d14703d8134e55ae817aae557c8afa1833a5bed9 Mon Sep 17 00:00:00 2001 From: Chris Tallon Date: Sun, 12 Mar 2006 17:26:44 +0000 Subject: [PATCH] segfault fix on no recording summary --- mvpclient.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) 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])); -- 2.39.2