diff --git a/ChangeLog b/ChangeLog index 0954fd81..89dbb50b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -21816,3 +21816,9 @@ * Cleaned up compile warnings in nextgen_filter(1). 2021-06-01 Fred Gleason * Cleaned up compile warnings in rdadmin(1). +2021-06-02 Fred Gleason + * 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'. diff --git a/lib/rdconfig.cpp b/lib/rdconfig.cpp index 14e8a688..5d9a5e49 100644 --- a/lib/rdconfig.cpp +++ b/lib/rdconfig.cpp @@ -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",""); diff --git a/lib/rddelete.cpp b/lib/rddelete.cpp index 30c01e4a..1b43f309 100644 --- a/lib/rddelete.cpp +++ b/lib/rddelete.cpp @@ -2,7 +2,7 @@ // // Delete a file from the audio store via the Rivendell Web Service // -// (C) Copyright 2010,2016-2017 Fred Gleason +// (C) Copyright 2010-2021 Fred Gleason // // 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()); diff --git a/lib/rdmblookup.cpp b/lib/rdmblookup.cpp index 1c4a0491..fd99264b 100644 --- a/lib/rdmblookup.cpp +++ b/lib/rdmblookup.cpp @@ -2,7 +2,7 @@ // // RDDiscLookup instance class for MusicBrainz // -// (C) Copyright 2003-2020 Fred Gleason +// (C) Copyright 2003-2021 Fred Gleason // // 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) { diff --git a/lib/rdtempdirectory.cpp b/lib/rdtempdirectory.cpp index 5e7cdb12..414e7906 100644 --- a/lib/rdtempdirectory.cpp +++ b/lib/rdtempdirectory.cpp @@ -2,7 +2,7 @@ // // Securely create and then remove a temporary directory // -// (C) Copyright 2017-2018 Fred Gleason +// (C) Copyright 2017-2021 Fred Gleason // // 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)); diff --git a/lib/rdunixserver.cpp b/lib/rdunixserver.cpp index 72b96bf3..01d7b810 100644 --- a/lib/rdunixserver.cpp +++ b/lib/rdunixserver.cpp @@ -2,7 +2,7 @@ // // UNIX Socket Server // -// (C) Copyright 2018 Fred Gleason +// (C) Copyright 2018-2021 Fred Gleason // // 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))+"]";