Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mpim-sw
libcdi
Commits
b2b2e660
Commit
b2b2e660
authored
Apr 10, 2014
by
Thomas Jahns
🤸
Browse files
Fix off-by-one error in range check.
parent
f43f8a2c
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/zaxis.c
View file @
b2b2e660
...
...
@@ -58,7 +58,7 @@ ZaxistypeEntry[] = {
};
enum
{
CDI_
Max
Zaxistype
=
sizeof
(
ZaxistypeEntry
)
/
sizeof
(
ZaxistypeEntry
[
0
]),
CDI_
Num
Zaxistype
=
sizeof
(
ZaxistypeEntry
)
/
sizeof
(
ZaxistypeEntry
[
0
]),
};
...
...
@@ -243,8 +243,8 @@ int zaxisCreate(int zaxistype, int size)
zaxisptr
->
type
=
zaxistype
;
zaxisptr
->
size
=
size
;
if
(
zaxistype
>
CDI_
MaxZ
axistype
)
Error
(
"Internal problem! zaxistype
>
CDI_
Max
Zaxistype"
);
if
(
zaxistype
>
=
CDI_
NumZaxistype
||
z
axistype
<
0
)
Error
(
"Internal problem! zaxistype
not in [0,
CDI_
Num
Zaxistype
)
"
);
zaxisDefName
(
zaxisID
,
ZaxistypeEntry
[
zaxistype
].
name
);
zaxisDefLongname
(
zaxisID
,
ZaxistypeEntry
[
zaxistype
].
longname
);
...
...
@@ -315,7 +315,7 @@ char *zaxisNamePtr(int zaxistype)
{
char
*
name
;
if
(
zaxistype
>=
0
&&
zaxistype
<
CDI_
Max
Zaxistype
)
if
(
zaxistype
>=
0
&&
zaxistype
<
CDI_
Num
Zaxistype
)
name
=
ZaxistypeEntry
[
zaxistype
].
longname
;
else
name
=
ZaxistypeEntry
[
ZAXIS_GENERIC
].
longname
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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