1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-11-24 00:45:52 +00:00

Sanitize Name and Location given in the command line.

Fix the bug with 8bit chars in the Name & Location in the text output.
This commit is contained in:
Andrey A. Chernov 2007-06-23 14:20:21 +00:00
parent ba5ad24a2c
commit eb0925e19a
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=194123
3 changed files with 53 additions and 5 deletions

View File

@ -10,7 +10,7 @@
PORTNAME= astrolog
PORTVERSION= 5.40
PORTREVISION= 4
PORTREVISION= 5
CATEGORIES= misc
MASTER_SITES= http://www.astrolog.org/ftp/ephem/:ephem \
http://www.astrolog.org/ftp/:dist

View File

@ -1,6 +1,14 @@
--- astrolog.c.orig Wed Dec 23 23:29:16 1998
+++ astrolog.c Fri May 25 21:07:58 2001
@@ -1146,8 +1146,18 @@
--- astrolog.c.orig 1998-12-23 23:29:07.000000000 +0300
+++ astrolog.c 2007-06-23 18:07:49.000000000 +0400
@@ -35,6 +35,7 @@
** Last code change made 12/20/1998.
*/
+#include <ctype.h>
#include "astrolog.h"
@@ -1146,8 +1147,18 @@
case 'z':
if (ch1 == '0') {
if (argc <= 1 || RParseSz(argv[1], pmZon) == rLarge) {
@ -21,7 +29,27 @@
SS = us.dstDef = i ? 1.0 : 0.0;
} else {
SS = us.dstDef = RParseSz(argv[1], pmZon);
@@ -1236,9 +1246,19 @@
@@ -1232,13 +1243,39 @@
return fFalse;
}
ciCore.nam = SzPersist(argv[1]);
+ if (CchSz(ciCore.nam) > 25) /* see xcharts0.c */
+ ciCore.nam[25] = chNull;
+ for (pch = ciCore.nam; *pch; pch++) {
+ if (*pch == '"') /* see io.c */
+ *pch = '\'';
+ else if (iscntrl((_char)*pch)) /* see xgeneral.c */
+ *pch = ' ';
+ }
ciCore.loc = SzPersist(argv[2]);
+ if (CchSz(ciCore.loc) > 25) /* see xcharts0.c */
+ ciCore.loc[25] = chNull;
+ for (pch = ciCore.loc; *pch; pch++) {
+ if (*pch == '"') /* see io.c */
+ *pch = '\'';
+ else if (iscntrl((_char)*pch)) /* see xgeneral.c */
+ *pch = ' ';
+ }
argc -= 2; argv += 2;
break;
}

View File

@ -0,0 +1,20 @@
--- charts1.c.bak 1998-12-23 23:29:26.000000000 +0300
+++ charts1.c 2007-06-23 16:28:33.000000000 +0400
@@ -53,7 +53,7 @@
char sz[cchSzDef];
int day, fNam, fLoc;
- fNam = *ciMain.nam > chNull; fLoc = *ciMain.loc > chNull;
+ fNam = *ciMain.nam != chNull; fLoc = *ciMain.loc != chNull;
AnsiColor(kWhite);
sprintf(sz, "%s %s chart ", szAppName, szVersionCore); PrintSz(sz);
if (fNoTimeOrSpace)
@@ -83,7 +83,7 @@
real rT;
CreateElemTable(&et);
- fNam = *ciMain.nam > chNull; fLoc = *ciMain.loc > chNull;
+ fNam = *ciMain.nam != chNull; fLoc = *ciMain.loc != chNull;
PrintHeader(); /* Show time and date of the chart being displayed. */