2021-06-02 Fred Gleason <fredg@paravelsystems.com>

* Cleaned up compile warnings in 'lib/rdconfig.cpp'.
	* Cleaned up compile warnings in 'lib/rddelete.cpp'.
	* Cleaned up compile warnings in 'lib/rdmblookup.cpp'.
	* Cleaned up compile warnings in 'lib/rdtempdirectory.cpp'.
	* Cleaned up compile warnings in 'lib/rdunixserver.cpp'.

Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
Fred Gleason 2021-06-02 12:24:01 -04:00
parent ed14f32f09
commit 38d3fd459e
6 changed files with 17 additions and 12 deletions

View File

@ -21816,3 +21816,9 @@
* Cleaned up compile warnings in nextgen_filter(1).
2021-06-01 Fred Gleason <fredg@paravelsystems.com>
* Cleaned up compile warnings in rdadmin(1).
2021-06-02 Fred Gleason <fredg@paravelsystems.com>
* Cleaned up compile warnings in 'lib/rdconfig.cpp'.
* Cleaned up compile warnings in 'lib/rddelete.cpp'.
* Cleaned up compile warnings in 'lib/rdmblookup.cpp'.
* Cleaned up compile warnings in 'lib/rdtempdirectory.cpp'.
* Cleaned up compile warnings in 'lib/rdunixserver.cpp'.

View File

@ -519,7 +519,7 @@ bool RDConfig::load()
}
gethostname(sname,255);
QStringList list=QString(sname).split("."); // Strip domain name parts
strncpy(sname,list.at(0).toUtf8(),256);
strncpy(sname,list.at(0).toUtf8(),255);
conf_station_name=
profile->stringValue("Identity","StationName",sname);
conf_password=profile->stringValue("Identity","Password","");

View File

@ -2,7 +2,7 @@
//
// Delete a file from the audio store via the Rivendell Web Service
//
// (C) Copyright 2010,2016-2017 Fred Gleason <fredg@paravelsystems.com>
// (C) Copyright 2010-2021 Fred Gleason <fredg@paravelsystems.com>
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 2 as
@ -107,7 +107,6 @@ RDDelete::ErrorCode RDDelete::runDelete(const QString &username,
QString currentdir;
QString filename;
QString xml="";
char userpwd[256];
if(!urlIsSupported(conv_target_url)) {
return RDDelete::ErrorUnsupportedUrlScheme;
@ -134,8 +133,8 @@ RDDelete::ErrorCode RDDelete::runDelete(const QString &username,
curl_easy_setopt(curl,CURLOPT_KEYPASSWD,password.toUtf8().constData());
}
else {
strncpy(userpwd,(username+":"+password).toUtf8(),256);
curl_easy_setopt(curl,CURLOPT_USERPWD,userpwd);
curl_easy_setopt(curl,CURLOPT_USERPWD,
(username+":"+password).toUtf8().constData());
}
curl_easy_setopt(curl,CURLOPT_URL,conv_target_url.toEncoded().constData());

View File

@ -2,7 +2,7 @@
//
// RDDiscLookup instance class for MusicBrainz
//
// (C) Copyright 2003-2020 Fred Gleason <fredg@paravelsystems.com>
// (C) Copyright 2003-2021 Fred Gleason <fredg@paravelsystems.com>
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU Library General Public License
@ -77,7 +77,7 @@ RDMbLookup::RDMbLookup(const QString &caption,FILE *profile_msgs,
temp_directory=NULL;
strncpy(tempdir,"/tmp",PATH_MAX);
if(getenv("TEMP")!=NULL) {
strncpy(tempdir,getenv("TEMP"),PATH_MAX);
strncpy(tempdir,getenv("TEMP"),PATH_MAX-1);
}
strncat(tempdir,"/rivendell-XXXXXX",PATH_MAX-strlen(tempdir));
if(mkdtemp(tempdir)==NULL) {

View File

@ -2,7 +2,7 @@
//
// Securely create and then remove a temporary directory
//
// (C) Copyright 2017-2018 Fred Gleason <fredg@paravelsystems.com>
// (C) Copyright 2017-2021 Fred Gleason <fredg@paravelsystems.com>
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 2 as
@ -61,7 +61,7 @@ bool RDTempDirectory::create(QString *err_msg)
{
char tempdir[PATH_MAX];
strncpy(tempdir,RDTempDirectory::basePath().toUtf8(),PATH_MAX);
strncpy(tempdir,RDTempDirectory::basePath().toUtf8(),PATH_MAX-1);
strncat(tempdir,"/",PATH_MAX-strlen(tempdir));
strncat(tempdir,temp_base_name.toUtf8(),PATH_MAX-strlen(tempdir));
strncat(tempdir,"XXXXXX",PATH_MAX-strlen(tempdir));

View File

@ -2,7 +2,7 @@
//
// UNIX Socket Server
//
// (C) Copyright 2018 Fred Gleason <fredg@paravelsystems.com>
// (C) Copyright 2018-2021 Fred Gleason <fredg@paravelsystems.com>
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 2 as
@ -84,7 +84,7 @@ bool RDUnixServer::listenToPathname(const QString &pathname)
}
memset(&sa,0,sizeof(sa));
sa.sun_family=AF_UNIX;
strncpy(sa.sun_path,pathname.toUtf8(),UNIX_PATH_MAX);
strncpy(sa.sun_path,pathname.toUtf8(),UNIX_PATH_MAX-1);
if(bind(unix_socket,(struct sockaddr *)(&sa),sizeof(sa))<0) {
unix_error_string=QString("unable to bind address")+" ["+
QString(strerror(errno))+"]";
@ -115,7 +115,7 @@ bool RDUnixServer::listenToAbstract(const QString &addr)
}
memset(&sa,0,sizeof(sa));
sa.sun_family=AF_UNIX;
strncpy(sa.sun_path+1,addr.toUtf8(),UNIX_PATH_MAX-1);
strncpy(sa.sun_path+1,addr.toUtf8(),UNIX_PATH_MAX-2);
if(bind(unix_socket,(struct sockaddr *)(&sa),sizeof(sa))<0) {
unix_error_string=QString("unable to bind address")+" ["+
QString(strerror(errno))+"]";