Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nx-libs
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
dimbor
nx-libs
Commits
4a345786
Commit
4a345786
authored
Nov 24, 2017
by
Ulrich Sibiller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Dialog.c,Display.c,NXdixfonts.c: replace strncpy() by snprintf where appropriate
parent
5987a7b1
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
11 additions
and
17 deletions
+11
-17
Args.h
nx-X11/programs/Xserver/hw/nxagent/Args.h
+1
-1
Dialog.c
nx-X11/programs/Xserver/hw/nxagent/Dialog.c
+2
-5
Display.c
nx-X11/programs/Xserver/hw/nxagent/Display.c
+5
-7
NXdixfonts.c
nx-X11/programs/Xserver/hw/nxagent/NXdixfonts.c
+2
-3
Reconnect.c
nx-X11/programs/Xserver/hw/nxagent/Reconnect.c
+1
-1
No files found.
nx-X11/programs/Xserver/hw/nxagent/Args.h
View file @
4a345786
...
@@ -53,7 +53,7 @@ struct UserGeometry{
...
@@ -53,7 +53,7 @@ struct UserGeometry{
extern
Bool
nxagentUseNXTrans
;
extern
Bool
nxagentUseNXTrans
;
extern
char
nxagentSessionId
[];
extern
char
nxagentSessionId
[];
extern
char
nxagentDisplayName
[];
extern
char
nxagentDisplayName
[
1024
];
extern
char
nxagentShadowDisplayName
[];
extern
char
nxagentShadowDisplayName
[];
extern
char
nxagentWindowName
[];
extern
char
nxagentWindowName
[];
extern
char
nxagentDialogName
[];
extern
char
nxagentDialogName
[];
...
...
nx-X11/programs/Xserver/hw/nxagent/Dialog.c
View file @
4a345786
...
@@ -279,16 +279,13 @@ void nxagentLaunchDialog(DialogType dialogType)
...
@@ -279,16 +279,13 @@ void nxagentLaunchDialog(DialogType dialogType)
if
(
dialogType
==
DIALOG_FAILED_RECONNECTION
)
if
(
dialogType
==
DIALOG_FAILED_RECONNECTION
)
{
{
s
trncpy
(
dialogDisplay
,
nxagentDisplayName
,
sizeof
(
dialogDisplay
)
-
1
);
s
nprintf
(
dialogDisplay
,
sizeof
(
dialogDisplay
),
"%s"
,
nxagentDisplayName
);
}
}
else
else
{
{
strcpy
(
dialogDisplay
,
":"
);
snprintf
(
dialogDisplay
,
sizeof
(
dialogDisplay
),
":%s"
,
display
);
strncat
(
dialogDisplay
,
display
,
sizeof
(
dialogDisplay
)
-
1
-
1
);
}
}
dialogDisplay
[
sizeof
(
dialogDisplay
)
-
1
]
=
'\0'
;
/*
/*
* We don't want to receive SIGCHLD
* We don't want to receive SIGCHLD
* before we store the child pid.
* before we store the child pid.
...
...
nx-X11/programs/Xserver/hw/nxagent/Display.c
View file @
4a345786
...
@@ -1150,9 +1150,7 @@ void nxagentOpenDisplay(int argc, char *argv[])
...
@@ -1150,9 +1150,7 @@ void nxagentOpenDisplay(int argc, char *argv[])
if
(
*
nxagentDisplayName
==
'\0'
)
if
(
*
nxagentDisplayName
==
'\0'
)
{
{
strncpy
(
nxagentDisplayName
,
XDisplayName
(
NULL
),
sizeof
(
nxagentDisplayName
)
-
1
);
snprintf
(
nxagentDisplayName
,
sizeof
(
nxagentDisplayName
),
"%s"
,
XDisplayName
(
NULL
));
nxagentDisplayName
[
sizeof
(
nxagentDisplayName
)
-
1
]
=
'\0'
;
}
}
nxagentCloseDisplay
();
nxagentCloseDisplay
();
...
@@ -1846,7 +1844,7 @@ static FILE *nxagentLookForIconFile(char *iconName, const char *permission,
...
@@ -1846,7 +1844,7 @@ static FILE *nxagentLookForIconFile(char *iconName, const char *permission,
{
{
strncpy
(
singlePath
,
path
,
(
unsigned
long
)(
end
-
path
));
strncpy
(
singlePath
,
path
,
(
unsigned
long
)(
end
-
path
));
singlePath
[(
unsigned
long
)(
end
-
path
)]
=
0
;
singlePath
[(
unsigned
long
)(
end
-
path
)]
=
'\0'
;
path
=
end
+
1
;
path
=
end
+
1
;
}
}
...
@@ -1859,7 +1857,7 @@ static FILE *nxagentLookForIconFile(char *iconName, const char *permission,
...
@@ -1859,7 +1857,7 @@ static FILE *nxagentLookForIconFile(char *iconName, const char *permission,
if
(
singlePath
[
strlen
(
singlePath
)
-
1
]
==
slash
[
0
])
if
(
singlePath
[
strlen
(
singlePath
)
-
1
]
==
slash
[
0
])
{
{
singlePath
[
strlen
(
singlePath
)
-
1
]
=
0
;
singlePath
[
strlen
(
singlePath
)
-
1
]
=
'\0'
;
}
}
if
(
strlen
(
singlePath
)
+
strlen
(
iconName
)
+
1
<
sizeof
(
singlePath
)
<
)
if
(
strlen
(
singlePath
)
+
strlen
(
iconName
)
+
1
<
sizeof
(
singlePath
)
<
)
...
@@ -1907,8 +1905,8 @@ Bool nxagentMakeIcon(Display *display, Pixmap *nxIcon, Pixmap *nxMask)
...
@@ -1907,8 +1905,8 @@ Bool nxagentMakeIcon(Display *display, Pixmap *nxIcon, Pixmap *nxMask)
agentIconData
=
nxagentIconData
;
agentIconData
=
nxagentIconData
;
}
}
/* FIXME: use a compile time define here, /usr/NX is a nomachine path */
snprintf
(
default_path
,
PATH_MAX
-
1
,
"/usr/NX/share/images/%s"
,
agent_icon_name
);
snprintf
(
default_path
,
sizeof
(
default_path
)
,
"/usr/NX/share/images/%s"
,
agent_icon_name
);
if
((
icon_fp
=
fopen
(
default_path
,
"r"
))
==
NULL
)
if
((
icon_fp
=
fopen
(
default_path
,
"r"
))
==
NULL
)
{
{
...
...
nx-X11/programs/Xserver/hw/nxagent/NXdixfonts.c
View file @
4a345786
...
@@ -112,7 +112,7 @@ static const char *_NXGetFontPath(const char *path)
...
@@ -112,7 +112,7 @@ static const char *_NXGetFontPath(const char *path)
* Check the environment only once.
* Check the environment only once.
*/
*/
if
(
*
_NXFontPath
!=
'\0'
)
if
(
_NXFontPath
[
0
]
!=
'\0'
)
{
{
return
_NXFontPath
;
return
_NXFontPath
;
}
}
...
@@ -140,8 +140,7 @@ static const char *_NXGetFontPath(const char *path)
...
@@ -140,8 +140,7 @@ static const char *_NXGetFontPath(const char *path)
_NXGetFontPathError:
_NXGetFontPathError:
strncpy
(
_NXFontPath
,
path
,
sizeof
(
_NXFontPath
)
-
1
);
snprintf
(
_NXFontPath
,
sizeof
(
_NXFontPath
),
"%s"
,
path
);
_NXFontPath
[
sizeof
(
_NXFontPath
)
-
1
]
=
'\0'
;
#ifdef NX_TRANS_TEST
#ifdef NX_TRANS_TEST
fprintf
(
stderr
,
"_NXGetFontPath: Using default font path [%s].
\n
"
,
_NXFontPath
);
fprintf
(
stderr
,
"_NXGetFontPath: Using default font path [%s].
\n
"
,
_NXFontPath
);
...
...
nx-X11/programs/Xserver/hw/nxagent/Reconnect.c
View file @
4a345786
...
@@ -139,7 +139,7 @@ char stateFile[PATH_MAX];
...
@@ -139,7 +139,7 @@ char stateFile[PATH_MAX];
void
setStatePath
(
char
*
path
)
void
setStatePath
(
char
*
path
)
{
{
s
trncpy
(
stateFile
,
path
,
PATH_MAX
-
1
);
s
nprintf
(
stateFile
,
PATH_MAX
,
"%s"
,
path
);
}
}
void
saveAgentState
(
char
*
state
)
void
saveAgentState
(
char
*
state
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment