diff options
-rw-r--r-- | www/plugger/files/patch-plugger-helper.c | 77 | ||||
-rw-r--r-- | www/plugger/files/patch-plugger.c | 44 |
2 files changed, 121 insertions, 0 deletions
diff --git a/www/plugger/files/patch-plugger-helper.c b/www/plugger/files/patch-plugger-helper.c new file mode 100644 index 000000000000..6e8c951987d8 --- /dev/null +++ b/www/plugger/files/patch-plugger-helper.c @@ -0,0 +1,77 @@ +--- plugger-helper.c.orig Sun Dec 9 22:41:11 2001 ++++ plugger-helper.c Sun Mar 24 23:29:20 2002 +@@ -30,6 +30,7 @@ + #include <sys/stat.h> + #include <sys/wait.h> + #include <errno.h> ++#include <stdlib.h> + #include <sys/time.h> + #include <X11/X.h> + #include <X11/Xos.h> +@@ -355,10 +356,10 @@ + /* Time to steal the lock! */ + mode=PropModeReplace; + gettimeofday(&tv, 0); +- INC_TIME(&tv, 0, 10000 + (rand() & 16383)); ++ INC_TIME(&tv, 0, 10000 + (random() & 16383)); + break; + } +- my_usleep((rand() & 16383) + 2000); /* 0.18383 seconds */ ++ my_usleep((random() & 16383) + 2000); /* 0.18383 seconds */ + } + + D("XChangeProperty, mode=%d\n",mode); +@@ -401,6 +402,7 @@ + got_sigwinch=1; + } + ++#define LONG_CHARS 12 + + int main(int argc, char **argv) + { +@@ -493,30 +495,30 @@ + loops=MIN(repeats,10); + for(e=0;e<loops;e++) + { +- strcat(foo," "); +- strcat(foo,file); ++ strncat(foo," ", 1); ++ strncat(foo,file,strlen(file)); + } + }else{ +- sprintf(foo,"file=%s",file); ++ snprintf(foo,strlen(file)+1+5,"file=%s",file); + } + putenv(foo); + foo+=strlen(foo)+1; + } + + /* setup environment variable $env */ +- sprintf(foo,"window=%ld",(long)WINDOW); ++ snprintf(foo,LONG_CHARS+7+1,"window=%ld",(long)WINDOW); + putenv(foo); + foo+=strlen(foo)+1; + + /* setup environment variable $repeat */ +- sprintf(foo,"repeat=%ld",(long)repeats); ++ snprintf(foo,LONG_CHARS+7+1,"repeat=%ld",(long)repeats); + putenv(foo); + foo+=strlen(foo)+1; + + /* setup environment variable $DISPLAY */ + if(displayname) + { +- sprintf(foo,"DISPLAY=%s",displayname); ++ snprintf(foo,strlen(displayname)+1+8,"DISPLAY=%s",displayname); + D("putenv(%s)\n",foo); + putenv(foo); + foo+=strlen(foo)+1; +@@ -526,7 +528,7 @@ + /* setup environment variable $mimetype */ + if(mimetype) + { +- sprintf(foo,"mimetype=%s",mimetype); ++ snprintf(foo,strlen(mimetype)+1+9,"mimetype=%s",mimetype); + D("putenv(%s)\n",foo); + putenv(foo); + foo+=strlen(foo)+1; diff --git a/www/plugger/files/patch-plugger.c b/www/plugger/files/patch-plugger.c new file mode 100644 index 000000000000..ee9a2bb33344 --- /dev/null +++ b/www/plugger/files/patch-plugger.c @@ -0,0 +1,44 @@ +--- plugger.c.orig Sun Mar 24 20:58:49 2002 ++++ plugger.c Sun Mar 24 21:06:15 2002 +@@ -437,33 +437,31 @@ + D("find_helper_file '%s'\n",basename); + if((tmp=getenv("HOME")) && strlen(tmp)<8000) + { +- sprintf(fname,"%s/.netscape/%s",tmp,basename); ++ snprintf(fname,strlen(tmp)+11+strlen(basename)+1,"%s/.netscape/%s",tmp,basename); + if(cb(fname,data)) return 1; +- sprintf(fname,"%s/.mozilla/%s",tmp,basename); ++ snprintf(fname,strlen(tmp)+10+strlen(basename)+1,"%s/.mozilla/%s",tmp,basename); + if(cb(fname,data)) return 1; +- sprintf(fname,"%s/.opera/%s",tmp,basename); ++ snprintf(fname,strlen(tmp)+8+strlen(basename)+1,"%s/.opera/%s",tmp,basename); + if(cb(fname,data)) return 1; + } + + if((tmp=getenv("MOZILLA_HOME")) && strlen(tmp)<8000) + { +- sprintf(fname,"%s/%s",tmp,basename); ++ snprintf(fname,strlen(tmp)+1+strlen(basename)+1,"%s/%s",tmp,basename); + if(cb(fname, data)) return 1; + } + + if((tmp=getenv("OPERA_DIR")) && strlen(tmp)<8000) + { +- sprintf(fname,"%s/%s",tmp,basename); ++ snprintf(fname,strlen(tmp)+1+strlen(basename)+1,"%s/%s",tmp,basename); + if(cb(fname, data)) return 1; + } + +- sprintf(fname,"/usr/local/netscape/%s",basename); ++ snprintf(fname,strlen(basename)+5+1,"/etc/%s",basename); + if(cb(fname, data)) return 1; +- sprintf(fname,"/etc/%s",basename); ++ snprintf(fname,strlen(basename)+9+1,"/usr/etc/%s",basename); + if(cb(fname, data)) return 1; +- sprintf(fname,"/usr/etc/%s",basename); +- if(cb(fname, data)) return 1; +- sprintf(fname,"/usr/local/etc/%s",basename); ++ snprintf(fname,strlen(basename)+15+1,"/usr/local/etc/%s",basename); + if(cb(fname, data)) return 1; + if(cb(basename, data)) return 1; + |