summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2013-03-05 09:49:00 +1100
committerDamien Miller <djm@mindrot.org>2013-03-05 09:49:00 +1100
commit43e5e60badb827104363169c333b0b7eadb0d09a (patch)
tree84cc038ca19768bed4cc247c6c4b030e16c57f03
parent21f591b6d975301fd005b4c031dffa0efefded08 (diff)
- (djm) [regress/modpipe.c] Compilation fix for AIX and parsing fix for
HP/UX. Spotted by Kevin Brott
-rw-r--r--ChangeLog4
-rwxr-xr-xregress/modpipe.c21
2 files changed, 20 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 2dcde27c..8190c663 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+20130305
+ - (djm) [regress/modpipe.c] Compilation fix for AIX and parsing fix for
+ HP/UX. Spotted by Kevin Brott
+
20130227
- (djm) [README contrib/caldera/openssh.spec contrib/redhat/openssh.spec]
[contrib/suse/openssh.spec] Crank version numbers
diff --git a/regress/modpipe.c b/regress/modpipe.c
index 1f17e41f..9629aa80 100755
--- a/regress/modpipe.c
+++ b/regress/modpipe.c
@@ -16,6 +16,8 @@
/* $OpenBSD: modpipe.c,v 1.4 2013/02/20 08:29:27 djm Exp $ */
+#include "includes.h"
+
#include <sys/types.h>
#include <unistd.h>
#include <stdio.h>
@@ -74,20 +76,29 @@ static void
parse_modification(const char *s, struct modification *m)
{
char what[16+1];
- int n;
+ int n, m1, m2;
bzero(m, sizeof(*m));
- if ((n = sscanf(s, "%16[^:]%*[:]%lli%*[:]%hhi%*[:]%hhi",
- what, &m->offset, &m->m1, &m->m2)) < 3)
+ if ((n = sscanf(s, "%16[^:]%*[:]%lli%*[:]%i%*[:]%i",
+ what, &m->offset, &m1, &m2)) < 3)
errx(1, "Invalid modification spec \"%s\"", s);
if (strcasecmp(what, "xor") == 0) {
- m->what = MOD_XOR;
if (n > 3)
errx(1, "Invalid modification spec \"%s\"", s);
+ if (m1 < 0 || m1 > 0xff)
+ errx(1, "Invalid XOR modification value");
+ m->what = MOD_XOR;
+ m->m1 = m1;
} else if (strcasecmp(what, "andor") == 0) {
- m->what = MOD_AND_OR;
if (n != 4)
errx(1, "Invalid modification spec \"%s\"", s);
+ if (m1 < 0 || m1 > 0xff)
+ errx(1, "Invalid AND modification value");
+ if (m2 < 0 || m2 > 0xff)
+ errx(1, "Invalid OR modification value");
+ m->what = MOD_AND_OR;
+ m->m1 = m1;
+ m->m2 = m2;
} else
errx(1, "Invalid modification type \"%s\"", what);
}