mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-02-15 04:32:24 +00:00
dtfile: coverity CIDs 88363,88405,89140,89612; insecure readlink
This commit is contained in:
parent
b4c4fb594d
commit
7fa35c29c4
3 changed files with 4 additions and 4 deletions
|
@ -825,7 +825,7 @@ ReadFileData(
|
||||||
{
|
{
|
||||||
while ((link_len = readlink(link_file_name, link_path, MAX_PATH)) > 0)
|
while ((link_len = readlink(link_file_name, link_path, MAX_PATH)) > 0)
|
||||||
{
|
{
|
||||||
link_path[link_len] = '\0';
|
link_path[link_len-1] = 0;
|
||||||
link_list = (char **)XtRealloc((char *)link_list, sizeof(char *) *
|
link_list = (char **)XtRealloc((char *)link_list, sizeof(char *) *
|
||||||
(link_count + 2));
|
(link_count + 2));
|
||||||
|
|
||||||
|
@ -1071,7 +1071,7 @@ ReadFileData2(
|
||||||
{
|
{
|
||||||
while ((link_len = readlink(link_file_name, link_path, MAX_PATH)) > 0)
|
while ((link_len = readlink(link_file_name, link_path, MAX_PATH)) > 0)
|
||||||
{
|
{
|
||||||
link_path[link_len] = NILL;
|
link_path[link_len - 1] = 0;
|
||||||
link_list = (char **)XtRealloc((char *)link_list, sizeof(char *) *
|
link_list = (char **)XtRealloc((char *)link_list, sizeof(char *) *
|
||||||
(link_count + 2));
|
(link_count + 2));
|
||||||
|
|
||||||
|
|
|
@ -236,7 +236,7 @@ _DtFollowLink (
|
||||||
|
|
||||||
while ((link_len = readlink(file, link_path, MAXPATHLEN)) > 0)
|
while ((link_len = readlink(file, link_path, MAXPATHLEN)) > 0)
|
||||||
{
|
{
|
||||||
link_path[link_len] = '\0';
|
link_path[link_len-1] = 0;
|
||||||
|
|
||||||
/* Force the link to be an absolute path, if necessary */
|
/* Force the link to be an absolute path, if necessary */
|
||||||
if (link_path[0] != '/')
|
if (link_path[0] != '/')
|
||||||
|
|
|
@ -187,7 +187,7 @@ CopyLink(char *sourceP, char *targetP, int repl, struct stat *statP)
|
||||||
} while (l < 0 && errno == EINTR);
|
} while (l < 0 && errno == EINTR);
|
||||||
if (l < 0)
|
if (l < 0)
|
||||||
return errno;
|
return errno;
|
||||||
buf[l] = 0;
|
buf[l-1] = 0;
|
||||||
if (symlink(buf, targetP) == 0)
|
if (symlink(buf, targetP) == 0)
|
||||||
return 0;
|
return 0;
|
||||||
else if (errno != EEXIST || !repl)
|
else if (errno != EEXIST || !repl)
|
||||||
|
|
Loading…
Reference in a new issue