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
c194fc8d
Commit
c194fc8d
authored
Apr 22, 2014
by
Thomas Jahns
🤸
Browse files
Replace use of strcpy from user-provided strings with strncpy.
parent
2df23f99
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/zaxis.c
View file @
c194fc8d
...
...
@@ -355,7 +355,10 @@ void zaxisDefName(int zaxisID, const char *name)
zaxis_check_ptr
(
zaxisID
,
zaxisptr
);
if
(
name
)
strcpy
(
zaxisptr
->
name
,
name
);
{
strncpy
(
zaxisptr
->
name
,
name
,
CDI_MAX_NAME
-
1
);
zaxisptr
->
name
[
CDI_MAX_NAME
-
1
]
=
'\0'
;
}
}
/*
...
...
@@ -387,7 +390,10 @@ void zaxisDefLongname(int zaxisID, const char *longname)
zaxis_check_ptr
(
zaxisID
,
zaxisptr
);
if
(
longname
)
strcpy
(
zaxisptr
->
longname
,
longname
);
{
strncpy
(
zaxisptr
->
longname
,
longname
,
CDI_MAX_NAME
-
1
);
zaxisptr
->
longname
[
CDI_MAX_NAME
-
1
]
=
'\0'
;
}
}
/*
...
...
@@ -419,7 +425,10 @@ void zaxisDefUnits(int zaxisID, const char *units)
zaxis_check_ptr
(
zaxisID
,
zaxisptr
);
if
(
units
)
strcpy
(
zaxisptr
->
units
,
units
);
{
strncpy
(
zaxisptr
->
units
,
units
,
CDI_MAX_NAME
-
1
);
zaxisptr
->
units
[
CDI_MAX_NAME
-
1
]
=
'\0'
;
}
}
/*
...
...
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