pidgin: 8b5c6acd: Use MAXPATHLEN instead of 256 for some p...

elb at pidgin.im elb at pidgin.im
Thu Aug 11 12:42:11 EDT 2011


----------------------------------------------------------------------
Revision: 8b5c6acd4648be88525b4b1d837cc7f493bdddf6
Parent:   b55fa7e527d663bdb8c0320d6d035488e8446978
Author:   elb at pidgin.im
Date:     08/11/11 12:08:40
Branch:   im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/8b5c6acd4648be88525b4b1d837cc7f493bdddf6

Changelog: 

Use MAXPATHLEN instead of 256 for some path buffer sizes

Changes against parent b55fa7e527d663bdb8c0320d6d035488e8446978

  patched  ChangeLog
  patched  libpurple/plugins/filectl.c

-------------- next part --------------
============================================================
--- ChangeLog	9b947bba5acaba9e27eb53ba8d416f20d82707b5
+++ ChangeLog	1601f24796178a3802e8f67481df198eb03c6c7d
@@ -16,6 +16,9 @@ version 2.10.0 (MM/DD/YYYY):
 	  string buffer overrun bugs.
 	  (The Electronic Frontier Foundation, Dan Auerbach, Chris Palmer,
           Jacob Appelbaum)
+	* Change some filename manipulations in filectl.c to use MAXPATHLEN
+	  instead of arbitrary length constants.  (The Electronic Frontier
+	  Foundation, Dan Auerbach, Chris Palmer, Jacob Appelbaum)
 
 	Gadu-Gadu:
 	* Fixed searching for buddies in public directory. (Tomasz Wasilczyk)
============================================================
--- libpurple/plugins/filectl.c	23d49eb815d2987ec8ee8a32ece78be92a658291
+++ libpurple/plugins/filectl.c	50bb6f8b9151a71262d31ea643e228314670c189
@@ -40,12 +40,12 @@ run_commands()
 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 @@ init_file()
 {
 	/* 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 @@ check_file()
 {
 	/* 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))
 	{


More information about the Commits mailing list