segfault fix on no recording summary
authorChris Tallon <chris@vomp.tv>
Sun, 12 Mar 2006 17:26:44 +0000 (17:26 +0000)
committerChris Tallon <chris@vomp.tv>
Sun, 12 Mar 2006 17:26:44 +0000 (17:26 +0000)
mvpclient.c

index 0802127fa2e73d60306562d9f168a7273b9f3c3b..fe2a898addbdb2447b90835f7b099468edf98f56 100644 (file)
@@ -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]));