changeset 10:1e4ba8d8ffc2

Use strncat, fixed nacltai timestamp check
author Ivo Smits <Ivo@UCIS.nl>
date Sat, 04 Dec 2010 03:01:46 +0100
parents 640f620a55cf
children 5be1ecb80cc9
files src/proto.nacltai.c src/run.debian.c
diffstat 2 files changed, 5 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/proto.nacltai.c	Wed Oct 20 21:08:03 2010 +0200
+++ b/src/proto.nacltai.c	Sat Dec 04 03:01:46 2010 +0100
@@ -141,7 +141,7 @@
 	}
 	len -= overhead;
 	taia_unpack((char*)(enc + crypto_box_BOXZEROBYTES - noncelength), &d->cdtaic);
-	if (d->cdtaic.sec.x <= d->cdtaip.sec.x || d->cdtaic.nano <= d->cdtaip.nano || d->cdtaic.atto <= d->cdtaip.atto) { 
+	if (d->cdtaic.sec.x <= d->cdtaip.sec.x && d->cdtaic.nano <= d->cdtaip.nano && d->cdtaic.atto <= d->cdtaip.atto) { 
 		fprintf(stderr, "Timestamp going back, ignoring packet\n");
 		return 0;
 	}
--- a/src/run.debian.c	Wed Oct 20 21:08:03 2010 +0200
+++ b/src/run.debian.c	Sat Dec 04 03:01:46 2010 +0100
@@ -32,11 +32,11 @@
 char* getenvdeb(const char* name) {
 	char tmp[1024] = "IF_QT_";
 	if (strcmp(name, "INTERFACE") == 0) return getenv("IFACE");
-	if (strlen(tmp) + strlen(name) >= 1024) {
+	/*if (strlen(tmp) + strlen(name) >= 1024) {
 		fprintf(stderr, "Error: prefixed environment variable name is too long");
 		return NULL;
-	}
-	strcat(tmp, name);
+	}*/
+	strncat(tmp, name, 1024 - 6 - 1);
 	return getenv(tmp);
 }
 
@@ -70,4 +70,4 @@
 
 	*getconfig = (void*)getenvdeb;
 	((void (*)())tunmain)();
-}
\ No newline at end of file
+}