mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2024-11-16 07:11:05 +01:00
disable upper controls and enable all other
8bit codes due to lack of locale knowledge in daemon
This commit is contained in:
parent
07484d1f24
commit
4541df7be4
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=29432
@ -30,7 +30,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id$
|
||||
* $Id: comsat.c,v 1.8 1997/02/22 14:21:23 peter Exp $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
@ -251,11 +251,11 @@ jkfprintf(tp, user, file, offset)
|
||||
char file[];
|
||||
off_t offset;
|
||||
{
|
||||
register char *cp, ch;
|
||||
register unsigned char *cp, ch;
|
||||
register FILE *fi;
|
||||
register int linecnt, charcnt, inheader;
|
||||
register struct passwd *p;
|
||||
char line[BUFSIZ];
|
||||
unsigned char line[BUFSIZ];
|
||||
|
||||
/* Set effective uid to user in case mail drop is on nfs */
|
||||
if ((p = getpwnam(user)) != NULL)
|
||||
@ -291,15 +291,19 @@ jkfprintf(tp, user, file, offset)
|
||||
}
|
||||
/* strip weird stuff so can't trojan horse stupid terminals */
|
||||
for (cp = line; (ch = *cp) && ch != '\n'; ++cp, --charcnt) {
|
||||
if (!isprint(ch)) {
|
||||
if (ch & 0x80)
|
||||
/* disable upper controls and enable all other
|
||||
8bit codes due to lack of locale knowledge
|
||||
*/
|
||||
if (((ch & 0x80) && ch < 0xA0) ||
|
||||
(!(ch & 0x80) && !isprint(ch) &&
|
||||
!isspace(ch) && ch != '\007')
|
||||
) {
|
||||
if (ch & 0x80) {
|
||||
ch &= ~0x80;
|
||||
(void)fputs("M-", tp);
|
||||
ch &= 0177;
|
||||
if (!isprint(ch)) {
|
||||
if (ch == 0177)
|
||||
ch = '?';
|
||||
else
|
||||
ch |= 0x40;
|
||||
}
|
||||
if (iscntrl(ch)) {
|
||||
ch ^= 0x40;
|
||||
(void)fputc('^', tp);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user