X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=cde%2Fprograms%2Fdtlogin%2Fpolicy.c;h=1b61b0d75bf1f3c333ee33925d0fd4d3d52bb3c6;hb=ee4a0a37ea2352311e30f1c63df1d1b471c30e8d;hp=33d69a69ab1f44524b963045e7cb69db65f80bd9;hpb=83b6996daa2c5ae22fc2b69093814cb08314954a;p=oweals%2Fcde.git diff --git a/cde/programs/dtlogin/policy.c b/cde/programs/dtlogin/policy.c index 33d69a69..1b61b0d7 100644 --- a/cde/programs/dtlogin/policy.c +++ b/cde/programs/dtlogin/policy.c @@ -1,3 +1,25 @@ +/* + * CDE - Common Desktop Environment + * + * Copyright (c) 1993-2012, The Open Group. All rights reserved. + * + * These libraries and programs are free software; you can + * redistribute them and/or modify them under the terms of the GNU + * Lesser General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) + * any later version. + * + * These libraries and programs are distributed in the hope that + * they will be useful, but WITHOUT ANY WARRANTY; without even the + * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU Lesser General Public License for more + * details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with these libraries and programs; if not, write + * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth + * Floor, Boston, MA 02110-1301 USA + */ /* (c) Copyright 1997 The Open Group */ /* * * (c) Copyright 1993, 1994 Hewlett-Packard Company * @@ -142,14 +164,16 @@ Willing( #endif ret = AcceptableDisplayAddress (addr, connectionType, type); if (!ret) - sprintf (statusBuf, "Display not authorized to connect"); + snprintf (statusBuf, sizeof(statusBuf), "Display not authorized to connect"); else - sprintf (statusBuf, "%s", WillingMsg()); + snprintf (statusBuf, sizeof(statusBuf), "%s", WillingMsg()); #if 0 - sprintf (statusBuf, "host %s", localHostname()); + snprintf (statusBuf, sizeof(statusBuf), "host %s", localHostname()); #endif + /* enforce termination */ + statusBuf[255] = '\0'; - status->length = strlen (statusBuf); + status->length = strlen(statusBuf); status->data = (CARD8Ptr) malloc (status->length); if (!status->data) status->length = 0; @@ -240,7 +264,9 @@ WillingMsg( void ) strcat(tmpbuf,tmpfilename); - system(tmpbuf); + if(-1 == system(tmpbuf)) { + perror(strerror(errno)); + } if ((f = fopen(tmpfilename,"r")) != (FILE *) NULL) { fgets(tmpbuf,LINEBUFSIZE,f);