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:
parent
235a75c03c
commit
b881408be0
4 changed files with 19 additions and 14 deletions
|
@ -49,6 +49,7 @@
|
||||||
# include <sys/types.h>
|
# include <sys/types.h>
|
||||||
# include <sys/signal.h>
|
# include <sys/signal.h>
|
||||||
# include <setjmp.h>
|
# include <setjmp.h>
|
||||||
|
# include <errno.h>
|
||||||
# include <pwd.h>
|
# include <pwd.h>
|
||||||
# include "dm.h"
|
# include "dm.h"
|
||||||
# include "vgmsg.h"
|
# include "vgmsg.h"
|
||||||
|
@ -101,7 +102,7 @@ static const char *
|
||||||
_SysErrorMsg( int n )
|
_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");
|
return (s ? s : "no such error");
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,6 +54,7 @@
|
||||||
#ifdef _AIX
|
#ifdef _AIX
|
||||||
#ifdef _POWER
|
#ifdef _POWER
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <errno.h>
|
||||||
#include <sys/file.h>
|
#include <sys/file.h>
|
||||||
#endif /* _POWER */
|
#endif /* _POWER */
|
||||||
# include <usersec.h>
|
# include <usersec.h>
|
||||||
|
@ -331,8 +332,7 @@ static int
|
||||||
IOErrorHandler( Display *dpy )
|
IOErrorHandler( Display *dpy )
|
||||||
{
|
{
|
||||||
|
|
||||||
const char *s = ((errno >= 0 && errno < sys_nerr) ? sys_errlist[errno]
|
const char *s = strerror(errno);
|
||||||
: "unknown error");
|
|
||||||
|
|
||||||
LogError(ReadCatalog(
|
LogError(ReadCatalog(
|
||||||
MC_LOG_SET,MC_LOG_FATAL_IO,MC_DEF_LOG_FATAL_IO),
|
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) {
|
if (access (resources, R_OK) != 0) {
|
||||||
/** fallback to the C locale for resources **/
|
/** fallback to the C locale for resources **/
|
||||||
Debug("LoadXloginResources - cant access %s\n", 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);
|
free(resources);
|
||||||
resources = _ExpandLang(d->resources, "C");
|
resources = _ExpandLang(d->resources, "C");
|
||||||
if (access (resources, R_OK) != 0) {
|
if (access (resources, R_OK) != 0) {
|
||||||
/** can't find a resource file, so bail **/
|
/** can't find a resource file, so bail **/
|
||||||
Debug("LoadXloginResources - cant access %s.\n", resources);
|
Debug("LoadXloginResources - cant access %s.\n", resources);
|
||||||
Debug("\t %s. Unable to find resource file.\n",
|
Debug("\t %s. Unable to find resource file.\n",
|
||||||
sys_errlist[errno]);
|
strerror(errno));
|
||||||
free(resources);
|
free(resources);
|
||||||
return(-1);
|
return(-1);
|
||||||
}
|
}
|
||||||
|
@ -775,7 +775,7 @@ LoadAltDtsResources(struct display *d)
|
||||||
if (access (resources, R_OK) != 0)
|
if (access (resources, R_OK) != 0)
|
||||||
{
|
{
|
||||||
Debug("LoadAltDtsResources- cant access %s.\n", resources);
|
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)
|
if (resources)
|
||||||
{
|
{
|
||||||
|
@ -787,7 +787,7 @@ LoadAltDtsResources(struct display *d)
|
||||||
if (access (resources, R_OK) != 0)
|
if (access (resources, R_OK) != 0)
|
||||||
{
|
{
|
||||||
Debug("LoadAltDtsResources- cant access %s.\n", resources);
|
Debug("LoadAltDtsResources- cant access %s.\n", resources);
|
||||||
Debug("\t %s.\n", sys_errlist[errno]);
|
Debug("\t %s.\n", strerror(errno));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
strcpy(dirname[j], resources);
|
strcpy(dirname[j], resources);
|
||||||
|
@ -828,7 +828,7 @@ LoadAltDtsResources(struct display *d)
|
||||||
{
|
{
|
||||||
Debug("LoadAltDtsResources- cant access %s.\n",
|
Debug("LoadAltDtsResources- cant access %s.\n",
|
||||||
resources);
|
resources);
|
||||||
Debug("\t %s.\n", sys_errlist[errno]);
|
Debug("\t %s.\n", strerror(errno));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1941,7 +1941,7 @@ RunGreeter( struct display *d, struct greet_info *greet,
|
||||||
char *p;
|
char *p;
|
||||||
char **env;
|
char **env;
|
||||||
char *path;
|
char *path;
|
||||||
struct greet_state state;
|
struct greet_state state = {};
|
||||||
int notify_dt;
|
int notify_dt;
|
||||||
|
|
||||||
#ifdef __PASSWD_ETC
|
#ifdef __PASSWD_ETC
|
||||||
|
@ -2441,7 +2441,11 @@ RunGreeter( struct display *d, struct greet_info *greet,
|
||||||
* the master struct. When the user logs out, the
|
* the master struct. When the user logs out, the
|
||||||
* resource-specified language (if any) will reactivate.
|
* 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) {
|
if (strcmp(d->language, "default") == 0) {
|
||||||
int len = strlen(defaultLanguage) + 1;
|
int len = strlen(defaultLanguage) + 1;
|
||||||
|
|
|
@ -325,7 +325,7 @@ userEnv(
|
||||||
char *value;
|
char *value;
|
||||||
char **exp;
|
char **exp;
|
||||||
char *Def_path;
|
char *Def_path;
|
||||||
char *langlist;
|
char *langlist = NULL;
|
||||||
|
|
||||||
#ifdef _AIX
|
#ifdef _AIX
|
||||||
/*
|
/*
|
||||||
|
@ -525,7 +525,7 @@ systemEnv( struct display *d, char *user, char *home )
|
||||||
char **env;
|
char **env;
|
||||||
char *value;
|
char *value;
|
||||||
char **exp;
|
char **exp;
|
||||||
char *langlist;
|
char *langlist = NULL;
|
||||||
|
|
||||||
env = 0;
|
env = 0;
|
||||||
|
|
||||||
|
|
|
@ -582,7 +582,7 @@ forward_respond (struct sockaddr *from, int fromlen, int length)
|
||||||
#ifdef AF_INET
|
#ifdef AF_INET
|
||||||
case AF_INET:
|
case AF_INET:
|
||||||
{
|
{
|
||||||
struct sockaddr_in in_addr;
|
static struct sockaddr_in in_addr;
|
||||||
|
|
||||||
if (clientAddress.length != 4 ||
|
if (clientAddress.length != 4 ||
|
||||||
clientPort.length != 2)
|
clientPort.length != 2)
|
||||||
|
@ -604,7 +604,7 @@ forward_respond (struct sockaddr *from, int fromlen, int length)
|
||||||
#ifdef AF_UNIX
|
#ifdef AF_UNIX
|
||||||
case AF_UNIX:
|
case AF_UNIX:
|
||||||
{
|
{
|
||||||
struct sockaddr_un un_addr;
|
static struct sockaddr_un un_addr;
|
||||||
|
|
||||||
if (clientAddress.length >= sizeof (un_addr.sun_path))
|
if (clientAddress.length >= sizeof (un_addr.sun_path))
|
||||||
goto badAddress;
|
goto badAddress;
|
||||||
|
|
Loading…
Reference in a new issue