projects
/
dockapps
/
wmnotify.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
NULL terminate strncpy destination string
[dockapps/wmnotify.git]
/
src
/
configfile.c
diff --git
a/src/configfile.c
b/src/configfile.c
index
c9b9621
..
303ae16
100644
(file)
--- a/
src/configfile.c
+++ b/
src/configfile.c
@@
-271,8
+271,9
@@
static void ParseConfigurationFile(FILE *file)
}
} else if (STREQ(token, "server")) {
token = GetArguments("server", true);
}
} else if (STREQ(token, "server")) {
token = GetArguments("server", true);
- strncpy(wmnotify_infos.server_name, token,
- MAX_STR_LEN);
+ strncpy(wmnotify_infos.server_name, token, MAX_STR_LEN - 1);
+ wmnotify_infos.server_name[
+ sizeof(wmnotify_infos.server_name) - 1] = '\0';
server_found = true;
} else if (STREQ(token, "port")) {
token = GetArguments("port", true);
server_found = true;
} else if (STREQ(token, "port")) {
token = GetArguments("port", true);
@@
-282,13
+283,15
@@
static void ParseConfigurationFile(FILE *file)
else if (STREQ(token, "username")) {
token = GetArguments("username", true);
else if (STREQ(token, "username")) {
token = GetArguments("username", true);
- strncpy(wmnotify_infos.username, token,
- MAX_STR_LEN);
+ strncpy(wmnotify_infos.username, token, MAX_STR_LEN - 1);
+ wmnotify_infos.username[
+ sizeof(wmnotify_infos.username) - 1] = '\0';
username_found = true;
} else if (STREQ(token, "password")) {
token = GetArguments("password", true);
username_found = true;
} else if (STREQ(token, "password")) {
token = GetArguments("password", true);
- strncpy(wmnotify_infos.password, token,
- MAX_STR_LEN);
+ strncpy(wmnotify_infos.password, token, MAX_STR_LEN - 1);
+ wmnotify_infos.password[
+ sizeof(wmnotify_infos.password) - 1] = '\0';
password_found = true;
} else if (STREQ(token, "mailcheckdelay")) {
int delay; /* delay in minutes. */
password_found = true;
} else if (STREQ(token, "mailcheckdelay")) {
int delay; /* delay in minutes. */