mirror of
https://bitbucket.org/smil3y/kde-workspace.git
synced 2025-02-23 18:32:50 +00:00
ksmserver: zero-initialize the gethostname() buffers
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
a1378c0bd8
commit
27b1b53595
3 changed files with 9 additions and 5 deletions
|
@ -35,6 +35,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <sys/time.h>
|
||||
#include <time.h>
|
||||
|
||||
|
@ -93,7 +94,8 @@ char * safeSmsGenerateClientID( SmsConn /*c*/ )
|
|||
/* Faking our IP address, the 0 below is "unknown" address format
|
||||
(1 would be IP, 2 would be DEC-NET format) */
|
||||
char hostname[ 256 ];
|
||||
if( gethostname( hostname, 255 ) != 0 )
|
||||
::memset(hostname, '\0', sizeof(hostname));
|
||||
if( ::gethostname( hostname, 255 ) != 0 )
|
||||
my_addr->sprintf("0%.8x", KRandom::random());
|
||||
else {
|
||||
// create some kind of hash for the hostname
|
||||
|
|
|
@ -33,6 +33,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
|
||||
#include <sys/time.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "server.h"
|
||||
|
||||
|
@ -360,8 +361,8 @@ QString KSMServer::windowWmClientMachine(WId w)
|
|||
} else {
|
||||
// special name for the local machine (localhost)
|
||||
char hostnamebuf[80];
|
||||
if (gethostname (hostnamebuf, sizeof hostnamebuf) >= 0) {
|
||||
hostnamebuf[sizeof(hostnamebuf)-1] = 0;
|
||||
::memset(hostnamebuf, '\0', sizeof(hostnamebuf));
|
||||
if (::gethostname (hostnamebuf, sizeof(hostnamebuf)) >= 0) {
|
||||
if (result == hostnamebuf)
|
||||
result = "localhost";
|
||||
if(char *dot = strchr(hostnamebuf, '.')) {
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
#include "curtaineffect.h"
|
||||
|
||||
#include <unistd.h> // for gethostname()
|
||||
|
||||
#include <string.h> // for memset()
|
||||
|
||||
static bool localDisplay(Display *dpy)
|
||||
{
|
||||
|
@ -46,7 +46,8 @@ static bool localDisplay(Display *dpy)
|
|||
return true;
|
||||
|
||||
char name[2048];
|
||||
gethostname(name, sizeof(name));
|
||||
::memset(name, '\0', sizeof(name));
|
||||
::gethostname(name, sizeof(name));
|
||||
|
||||
if (hostPart == name)
|
||||
return true;
|
||||
|
|
Loading…
Add table
Reference in a new issue