1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-02-15 04:32:24 +00:00

dtlogin: Coverity (memory corruption, moderate)

This commit is contained in:
Jon Trulson 2014-12-26 16:55:46 -07:00
parent 235a75c03c
commit b881408be0
4 changed files with 19 additions and 14 deletions

View file

@ -49,6 +49,7 @@
# include <sys/types.h>
# include <sys/signal.h>
# include <setjmp.h>
# include <errno.h>
# include <pwd.h>
# include "dm.h"
# include "vgmsg.h"
@ -101,7 +102,7 @@ static const char *
_SysErrorMsg( int n )
{
const char *s = ((n >= 0 && n < sys_nerr) ? sys_errlist[n] : "unknown error");
const char *s = strerror(n);
return (s ? s : "no such error");
}

View file

@ -54,6 +54,7 @@
#ifdef _AIX
#ifdef _POWER
#include <stdio.h>
#include <errno.h>
#include <sys/file.h>
#endif /* _POWER */
# include <usersec.h>
@ -331,8 +332,7 @@ static int
IOErrorHandler( Display *dpy )
{
const char *s = ((errno >= 0 && errno < sys_nerr) ? sys_errlist[errno]
: "unknown error");
const char *s = strerror(errno);
LogError(ReadCatalog(
MC_LOG_SET,MC_LOG_FATAL_IO,MC_DEF_LOG_FATAL_IO),
@ -657,14 +657,14 @@ LoadXloginResources( struct display *d )
if (access (resources, R_OK) != 0) {
/** fallback to the C locale for resources **/
Debug("LoadXloginResources - cant access %s\n", resources);
Debug("\t %s. Falling back to C.\n", sys_errlist[errno]);
Debug("\t %s. Falling back to C.\n", strerror(errno));
free(resources);
resources = _ExpandLang(d->resources, "C");
if (access (resources, R_OK) != 0) {
/** can't find a resource file, so bail **/
Debug("LoadXloginResources - cant access %s.\n", resources);
Debug("\t %s. Unable to find resource file.\n",
sys_errlist[errno]);
strerror(errno));
free(resources);
return(-1);
}
@ -775,7 +775,7 @@ LoadAltDtsResources(struct display *d)
if (access (resources, R_OK) != 0)
{
Debug("LoadAltDtsResources- cant access %s.\n", resources);
Debug("\t %s. Falling back to C.\n", sys_errlist[errno]);
Debug("\t %s. Falling back to C.\n", strerror(errno));
if (resources)
{
@ -787,7 +787,7 @@ LoadAltDtsResources(struct display *d)
if (access (resources, R_OK) != 0)
{
Debug("LoadAltDtsResources- cant access %s.\n", resources);
Debug("\t %s.\n", sys_errlist[errno]);
Debug("\t %s.\n", strerror(errno));
}
else
strcpy(dirname[j], resources);
@ -828,7 +828,7 @@ LoadAltDtsResources(struct display *d)
{
Debug("LoadAltDtsResources- cant access %s.\n",
resources);
Debug("\t %s.\n", sys_errlist[errno]);
Debug("\t %s.\n", strerror(errno));
continue;
}
@ -1941,7 +1941,7 @@ RunGreeter( struct display *d, struct greet_info *greet,
char *p;
char **env;
char *path;
struct greet_state state;
struct greet_state state = {};
int notify_dt;
#ifdef __PASSWD_ETC
@ -2441,7 +2441,11 @@ RunGreeter( struct display *d, struct greet_info *greet,
* the master struct. When the user logs out, the
* resource-specified language (if any) will reactivate.
*/
Debug("Greeter returned language '%s'\n", d->language);
if (d->language)
Debug("Greeter returned language '%s'\n", d->language);
else
Debug("Greeter returned language (NULL)\n");
if (strcmp(d->language, "default") == 0) {
int len = strlen(defaultLanguage) + 1;

View file

@ -325,7 +325,7 @@ userEnv(
char *value;
char **exp;
char *Def_path;
char *langlist;
char *langlist = NULL;
#ifdef _AIX
/*
@ -525,7 +525,7 @@ systemEnv( struct display *d, char *user, char *home )
char **env;
char *value;
char **exp;
char *langlist;
char *langlist = NULL;
env = 0;

View file

@ -582,7 +582,7 @@ forward_respond (struct sockaddr *from, int fromlen, int length)
#ifdef AF_INET
case AF_INET:
{
struct sockaddr_in in_addr;
static struct sockaddr_in in_addr;
if (clientAddress.length != 4 ||
clientPort.length != 2)
@ -604,7 +604,7 @@ forward_respond (struct sockaddr *from, int fromlen, int length)
#ifdef AF_UNIX
case AF_UNIX:
{
struct sockaddr_un un_addr;
static struct sockaddr_un un_addr;
if (clientAddress.length >= sizeof (un_addr.sun_path))
goto badAddress;