--- gnome-peercast-0.5.4.orig/peercast/core/common/servent.cpp +++ gnome-peercast-0.5.4/peercast/core/common/servent.cpp @@ -184,8 +184,8 @@ nsSwitchNum = 0; pack.func = 255; lastConnect = lastPing = lastPacket = 0; - loginPassword[0] = 0; - loginMount[0] = 0; + loginPassword.clear(); + loginMount.clear(); bytesPerSecond = 0; priorityConnect = false; pushSock = NULL; --- gnome-peercast-0.5.4.orig/peercast/core/common/servent.h +++ gnome-peercast-0.5.4/peercast/core/common/servent.h @@ -254,8 +254,8 @@ ThreadInfo thread; - char loginPassword[64]; - char loginMount[64]; + String loginPassword; + String loginMount; bool priorityConnect; bool addMetadata; --- gnome-peercast-0.5.4.orig/peercast/core/common/servhs.cpp +++ gnome-peercast-0.5.4/peercast/core/common/servhs.cpp @@ -313,13 +313,13 @@ mount[-1] = 0; // password preceeds break; } - strcpy(loginPassword,in+7); + loginPassword.set(in+7); - LOG_DEBUG("ICY client: %s %s",loginPassword,mount?mount:"unknown"); + LOG_DEBUG("ICY client: %s %s",loginPassword.cstr(),mount?mount:"unknown"); } if (mount) - strcpy(loginMount,mount); + loginMount.set(mount); handshakeICY(Channel::SRC_ICECAST,isHTTP); sock = NULL; // socket is taken over by channel, so don`t close it @@ -329,7 +329,7 @@ if (!isAllowed(ALLOW_BROADCAST)) throw HTTPException(HTTP_SC_UNAVAILABLE,503); - strcpy(loginPassword,servMgr->password); // pwd already checked + loginPassword.set(servMgr->password); // pwd already checked sock->writeLine("OK2"); sock->writeLine("icy-caps:11"); @@ -1611,15 +1611,15 @@ while (http.nextHeader()) { LOG_DEBUG("ICY %s",http.cmdLine); - readICYHeader(http,info,loginPassword); + readICYHeader(http,info,loginPassword.cstr()); } // check password before anything else, if needed - if (strcmp(servMgr->password,loginPassword)!=0) + if (servMgr->password != loginPassword) { - if (!sock->host.isLocalhost() || strlen(loginPassword)) + if (!sock->host.isLocalhost() || !loginPassword.isEmpty()) throw HTTPException(HTTP_SC_UNAUTHORIZED,401); } @@ -1633,7 +1633,7 @@ info.id = chanMgr->broadcastID; - info.id.encode(NULL,info.name.cstr(),loginMount,info.bitrate); + info.id.encode(NULL,info.name.cstr(),loginMount.cstr(),info.bitrate); LOG_DEBUG("Incoming source: %s : %s",info.name.cstr(),ChanInfo::getTypeStr(info.contentType)); @@ -1654,7 +1654,7 @@ info.comment = chanMgr->broadcastMsg; info.bcID = chanMgr->broadcastID; - c = chanMgr->createChannel(info,loginMount); + c = chanMgr->createChannel(info,loginMount.cstr()); if (!c) throw HTTPException(HTTP_SC_UNAVAILABLE,503);