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
5987a7b1
Commit
5987a7b1
authored
Nov 23, 2017
by
Ulrich Sibiller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Dialog.c,Display.c,Font.c,NXdixfonts.c: don't use hardcoded string buffer lengths
parent
3c818997
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
18 additions
and
20 deletions
+18
-20
Dialog.c
nx-X11/programs/Xserver/hw/nxagent/Dialog.c
+7
-10
Display.c
nx-X11/programs/Xserver/hw/nxagent/Display.c
+3
-3
Font.c
nx-X11/programs/Xserver/hw/nxagent/Font.c
+4
-3
NXdixfonts.c
nx-X11/programs/Xserver/hw/nxagent/NXdixfonts.c
+4
-4
No files found.
nx-X11/programs/Xserver/hw/nxagent/Dialog.c
View file @
5987a7b1
...
...
@@ -279,15 +279,15 @@ void nxagentLaunchDialog(DialogType dialogType)
if
(
dialogType
==
DIALOG_FAILED_RECONNECTION
)
{
strncpy
(
dialogDisplay
,
nxagentDisplayName
,
255
);
strncpy
(
dialogDisplay
,
nxagentDisplayName
,
sizeof
(
dialogDisplay
)
-
1
);
}
else
{
strcpy
(
dialogDisplay
,
":"
);
strncat
(
dialogDisplay
,
display
,
254
);
strncat
(
dialogDisplay
,
display
,
sizeof
(
dialogDisplay
)
-
1
-
1
);
}
*
(
dialogDisplay
+
255
)
=
'\0'
;
dialogDisplay
[
sizeof
(
dialogDisplay
)
-
1
]
=
'\0'
;
/*
* We don't want to receive SIGCHLD
...
...
@@ -308,7 +308,7 @@ void nxagentLaunchDialog(DialogType dialogType)
DECODE_DIALOG_TYPE
(
dialogType
),
*
pid
,
dialogDisplay
);
#endif
*
dialogDisplay
=
'\0'
;
dialogDisplay
[
0
]
=
'\0'
;
/*
* Restore the previous set of
...
...
@@ -320,8 +320,7 @@ void nxagentLaunchDialog(DialogType dialogType)
void
nxagentPulldownDialog
(
Window
wid
)
{
snprintf
(
nxagentPulldownWindow
,
15
,
"%ld"
,
(
long
int
)
wid
);
nxagentPulldownWindow
[
15
]
=
0
;
snprintf
(
nxagentPulldownWindow
,
sizeof
(
nxagentPulldownWindow
),
"%ld"
,
(
long
int
)
wid
);
#ifdef TEST
fprintf
(
stderr
,
"nxagentPulldownDialog: Going to launch pulldown "
...
...
@@ -330,7 +329,7 @@ void nxagentPulldownDialog(Window wid)
nxagentLaunchDialog
(
DIALOG_PULLDOWN
);
nxagentPulldownWindow
[
0
]
=
0
;
nxagentPulldownWindow
[
0
]
=
'\0'
;
}
void
nxagentFailedReconnectionDialog
(
int
alert
,
char
*
error
)
...
...
@@ -372,9 +371,7 @@ void nxagentFailedReconnectionDialog(int alert, char *error)
int
status
;
int
options
=
0
;
snprintf
(
nxagentFailedReconnectionMessage
,
255
,
"Reconnection failed: %s"
,
error
);
*
(
nxagentFailedReconnectionMessage
+
255
)
=
'\0'
;
snprintf
(
nxagentFailedReconnectionMessage
,
sizeof
(
nxagentFailedReconnectionMessage
),
"Reconnection failed: %s"
,
error
);
nxagentLaunchDialog
(
DIALOG_FAILED_RECONNECTION
);
...
...
nx-X11/programs/Xserver/hw/nxagent/Display.c
View file @
5987a7b1
...
...
@@ -1150,9 +1150,9 @@ void nxagentOpenDisplay(int argc, char *argv[])
if
(
*
nxagentDisplayName
==
'\0'
)
{
strncpy
(
nxagentDisplayName
,
XDisplayName
(
NULL
),
1023
);
strncpy
(
nxagentDisplayName
,
XDisplayName
(
NULL
),
sizeof
(
nxagentDisplayName
)
-
1
);
nxagentDisplayName
[
1023
]
=
'\0'
;
nxagentDisplayName
[
sizeof
(
nxagentDisplayName
)
-
1
]
=
'\0'
;
}
nxagentCloseDisplay
();
...
...
@@ -1862,7 +1862,7 @@ static FILE *nxagentLookForIconFile(char *iconName, const char *permission,
singlePath
[
strlen
(
singlePath
)
-
1
]
=
0
;
}
if
(
strlen
(
singlePath
)
+
strlen
(
iconName
)
+
1
<
PATH_MAX
)
if
(
strlen
(
singlePath
)
+
strlen
(
iconName
)
+
1
<
sizeof
(
singlePath
)
<
)
{
strncat
(
singlePath
,
slash
,
1
);
strcat
(
singlePath
,
iconName
);
...
...
nx-X11/programs/Xserver/hw/nxagent/Font.c
View file @
5987a7b1
...
...
@@ -1406,15 +1406,16 @@ Bool nxagentDisconnectAllFonts()
static
Bool
nxagentGetFontServerPath
(
char
*
fontServerPath
)
{
char
path
[
256
];
/* ensure path is no longer than fontServerPath */
char
path
[
256
]
=
{
0
};
if
(
NXGetFontParameters
(
nxagentDisplay
,
256
,
path
)
==
True
)
if
(
NXGetFontParameters
(
nxagentDisplay
,
sizeof
(
path
)
,
path
)
==
True
)
{
if
(
*
path
!=
'\0'
)
{
strncpy
(
fontServerPath
,
path
+
1
,
*
path
);
*
(
fontServerPath
+
*
path
)
=
'\0'
;
fontServerPath
[
*
path
]
=
'\0'
;
#ifdef TEST
fprintf
(
stderr
,
"nxagentGetFontServerPath: Got path [%s].
\n
"
,
...
...
nx-X11/programs/Xserver/hw/nxagent/NXdixfonts.c
View file @
5987a7b1
...
...
@@ -121,7 +121,7 @@ static const char *_NXGetFontPath(const char *path)
if
(
fontEnv
!=
NULL
&&
*
fontEnv
!=
'\0'
)
{
if
(
strlen
(
fontEnv
)
+
1
>
1024
)
if
(
strlen
(
fontEnv
)
+
1
>
sizeof
(
_NXFontPath
)
)
{
#ifdef NX_TRANS_TEST
fprintf
(
stderr
,
"_NXGetFontPath: WARNING! Maximum length of font path exceeded.
\n
"
);
...
...
@@ -140,8 +140,8 @@ static const char *_NXGetFontPath(const char *path)
_NXGetFontPathError:
strncpy
(
_NXFontPath
,
path
,
1023
);
_NXFontPath
[
1023
]
=
'\0'
;
strncpy
(
_NXFontPath
,
path
,
sizeof
(
_NXFontPath
)
-
1
);
_NXFontPath
[
sizeof
(
_NXFontPath
)
-
1
]
=
'\0'
;
#ifdef NX_TRANS_TEST
fprintf
(
stderr
,
"_NXGetFontPath: Using default font path [%s].
\n
"
,
_NXFontPath
);
...
...
@@ -199,7 +199,7 @@ doOpenFont(ClientPtr client, OFclosurePtr c)
BitmapFormatScanlineUnit8
;
nxagentOrigFontNameLen
=
(
c
->
origFontNameLen
<
256
)
?
c
->
origFontNameLen
:
255
;
nxagentOrigFontNameLen
=
(
c
->
origFontNameLen
<
sizeof
(
nxagentOrigFontName
)
?
c
->
origFontNameLen
:
sizeof
(
nxagentOrigFontName
)
-
1
)
;
memcpy
(
nxagentOrigFontName
,
c
->
origFontName
,
nxagentOrigFontNameLen
);
...
...
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