Mercurial > pidgin.yaz
diff libpurple/plugins/filectl.c @ 32241:32ef245fd1f6
Use MAXPATHLEN instead of 256 for some path buffer sizes
author | Ethan Blanton <elb@pidgin.im> |
---|---|
date | Thu, 11 Aug 2011 16:08:40 +0000 |
parents | 7f552614ec8a |
children |
line wrap: on
line diff
--- a/libpurple/plugins/filectl.c Thu Aug 11 14:45:26 2011 +0000 +++ b/libpurple/plugins/filectl.c Thu Aug 11 16:08:40 2011 +0000 @@ -40,12 +40,12 @@ run_commands() { struct stat finfo; - char filename[256]; + char filename[MAXPATHLEN]; char buffer[1024]; char *command, *arg1, *arg2; FILE *file; - sprintf(filename, "%s" G_DIR_SEPARATOR_S "control", purple_user_dir()); + snprintf(filename, MAXPATHLEN, "%s" G_DIR_SEPARATOR_S "control", purple_user_dir()); file = g_fopen(filename, "r+"); while (fgets(buffer, sizeof(buffer), file)) { @@ -144,9 +144,9 @@ { /* most of this was taken from Bash v2.04 by the FSF */ struct stat finfo; - char filename[256]; + char filename[MAXPATHLEN]; - sprintf(filename, "%s" G_DIR_SEPARATOR_S "control", purple_user_dir()); + snprintf(filename, MAXPATHLEN, "%s" G_DIR_SEPARATOR_S "control", purple_user_dir()); if ((g_stat(filename, &finfo) == 0) && (finfo.st_size > 0)) run_commands(); @@ -160,9 +160,9 @@ { /* most of this was taken from Bash v2.04 by the FSF */ struct stat finfo; - char filename[256]; + char filename[MAXPATHLEN]; - sprintf(filename, "%s" G_DIR_SEPARATOR_S "control", purple_user_dir()); + snprintf(filename, MAXPATHLEN, "%s" G_DIR_SEPARATOR_S "control", purple_user_dir()); if ((g_stat(filename, &finfo) == 0) && (finfo.st_size > 0)) {