X-Git-Url: http://gitweb.hugovil.com/?a=blobdiff_plain;f=src%2Fconfigfile.c;h=303ae165362ebcbe3818e44d779211e36ce0ae7c;hb=44915ef56ef12a7440032daaaec403d58fe1b20e;hp=c9b96219ff4bcd69b21a03c16bf824da565d8bf1;hpb=13245184b602d8040fa4ac14497e4456397d31a4;p=dockapps%2Fwmnotify.git diff --git a/src/configfile.c b/src/configfile.c index c9b9621..303ae16 100644 --- 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); - 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); @@ -282,13 +283,15 @@ static void ParseConfigurationFile(FILE *file) 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); - 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. */