12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- --- wmGrabImage/wmGrabImage.c.orig Sun May 27 21:45:28 2001
- +++ wmGrabImage/wmGrabImage.c Wed Jun 18 22:55:56 2008
- @@ -158,7 +158,7 @@ int n, s, m, dt1, dt2, dt3, len;
- int Year, Month, Day;
- int Hours, Mins, Secs;
- int i, j, Width, Height, yoff, fd, Flag;
- -long CurrentLocalTime;
- +time_t CurrentLocalTime;
- double UT, hour24(), jd(), CurrentJD, OldFileUT, FileUT;
- char command[1040], ImageName[256];
- int havePixmap= 0;
- @@ -183,9 +183,9 @@ int havePixmap= 0;
- */
- len = strlen(ImageURL);
- for (j = 0, i=0; i<len; ++i){ if (ImageURL[i] == '/') j = i; }
- - strcpy(ImageName, ImageURL+j+1);
- - sprintf(XpmFileName, "%s/.wmGrabImage/%s.xpm", getenv("HOME"), ImageName);
- - sprintf(ImageFileName, "%s/.wmGrabImage/%s", getenv("HOME"), ImageName);
- + strlcpy(ImageName, ImageURL+j+1, sizeof(ImageName));
- + snprintf(XpmFileName, sizeof(XpmFileName), "%s/.wmGrabImage/%s.xpm", getenv("HOME"), ImageName);
- + snprintf(ImageFileName, sizeof(ImageFileName), "%s/.wmGrabImage/%s", getenv("HOME"), ImageName);
-
-
- openXwindow(argc, argv, wmGrabImage_master, wmGrabImage_mask_bits, wmGrabImage_mask_width, wmGrabImage_mask_height);
- @@ -426,9 +426,9 @@ int havePixmap= 0;
- * Execute Perl script to grab the Latest METAR Report
- */
- if (ConvertGeometry != NULL)
- - sprintf(command, "GrabImage %s %s &", ImageURL, ConvertGeometry);
- + snprintf(command, sizeof(command), "GrabImage %s %s &", ImageURL, ConvertGeometry);
- else
- - sprintf(command, "GrabImage %s &", ImageURL);
- + snprintf(command, sizeof(command), "GrabImage %s &", ImageURL);
- system(command);
-
- ForceUpdate = 1;
- @@ -470,7 +470,7 @@ void ParseCMDLine(int argc, char *argv[]) {
-
- } else if ((!strcmp(argv[i], "-url"))||(!strcmp(argv[i], "-u"))){
-
- - strcpy(ImageURL, argv[++i]);
- + strlcpy(ImageURL, argv[++i], sizeof(ImageURL));
-
- } else if (!strcmp(argv[i], "-delay")){
-
- @@ -482,7 +482,7 @@ void ParseCMDLine(int argc, char *argv[]) {
-
- } else if (!strcmp(argv[i], "-http")){
-
- - strcpy(HttpURL, argv[++i]);
- + strlcpy(HttpURL, argv[++i], sizeof(HttpURL));
-
- } else if (!strcmp(argv[i], "-geom")){
-
- @@ -604,7 +604,7 @@ void pressEvent(XButtonEvent *xev){
- if (GotDoubleClick1) {
- GotFirstClick1 = 0;
- GotDoubleClick1 = 0;
- - sprintf(Command, "xv %s &", ImageFileName);
- + snprintf(Command, sizeof(Command), "xv %s &", ImageFileName);
- system(Command);
- }
-
- @@ -615,7 +615,7 @@ void pressEvent(XButtonEvent *xev){
- if (GotDoubleClick2) {
- GotFirstClick2 = 0;
- GotDoubleClick2 = 0;
- - sprintf(Command, "netscape -remote 'openURL(%s)' || netscape '%s' &", HttpURL, HttpURL);
- + snprintf(Command, sizeof(Command), "netscape -remote 'openURL(%s)' || netscape '%s' &", HttpURL, HttpURL);
- system(Command);
- }
-
|