mirror of
https://gitea.psi.ch/ELOG/elog.git
synced 2026-09-10 18:23:28 +00:00
Fixed size parameter in strlcpy
This commit is contained in:
parent
6ee100501c
commit
3a5f2f0067
@ -4539,9 +4539,9 @@ int el_submit_attachment(LOGBOOK *lbs, const char *afilename, const char *buffer
|
|||||||
tms.tm_mday, tms.tm_hour, tms.tm_min, tms.tm_sec, file_name);
|
tms.tm_mday, tms.tm_hour, tms.tm_min, tms.tm_sec, file_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
strlcpy(path_name, lbs->data_dir, sizeof(str));
|
strlcpy(path_name, lbs->data_dir, sizeof(path_name));
|
||||||
generate_subdir_name(ext_file_name, subdir, sizeof(subdir));
|
generate_subdir_name(ext_file_name, subdir, sizeof(subdir));
|
||||||
strlcat(path_name, subdir, sizeof(str));
|
strlcat(path_name, subdir, sizeof(path_name));
|
||||||
if (strlen(path_name) > 0 && path_name[strlen(path_name) - 1] == DIR_SEPARATOR)
|
if (strlen(path_name) > 0 && path_name[strlen(path_name) - 1] == DIR_SEPARATOR)
|
||||||
path_name[strlen(path_name) - 1] = 0;
|
path_name[strlen(path_name) - 1] = 0;
|
||||||
|
|
||||||
@ -4557,7 +4557,7 @@ int el_submit_attachment(LOGBOOK *lbs, const char *afilename, const char *buffer
|
|||||||
/* test if file exists */
|
/* test if file exists */
|
||||||
do {
|
do {
|
||||||
strlcpy(str, path_name, sizeof(str));
|
strlcpy(str, path_name, sizeof(str));
|
||||||
strlcat(str, ext_file_name, sizeof(path_name));
|
strlcat(str, ext_file_name, sizeof(str));
|
||||||
|
|
||||||
fh = open(str, O_RDONLY, 0644);
|
fh = open(str, O_RDONLY, 0644);
|
||||||
if (fh > 0) {
|
if (fh > 0) {
|
||||||
@ -4576,7 +4576,7 @@ int el_submit_attachment(LOGBOOK *lbs, const char *afilename, const char *buffer
|
|||||||
strlcpy(full_name, ext_file_name, MAX_PATH_LENGTH);
|
strlcpy(full_name, ext_file_name, MAX_PATH_LENGTH);
|
||||||
|
|
||||||
strlcpy(str, path_name, sizeof(str));
|
strlcpy(str, path_name, sizeof(str));
|
||||||
strlcat(str, ext_file_name, sizeof(path_name));
|
strlcat(str, ext_file_name, sizeof(str));
|
||||||
|
|
||||||
/* save attachment */
|
/* save attachment */
|
||||||
fh = open(str, O_CREAT | O_RDWR | O_BINARY, 0644);
|
fh = open(str, O_CREAT | O_RDWR | O_BINARY, 0644);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user