chiark
/
gitweb
/
~ianmdlvl
/
adns.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
SECURITY: adns: Do not corrupt pointer when nameserver speaks first
[adns.git]
/
regress
/
hcommon.c
diff --git
a/regress/hcommon.c
b/regress/hcommon.c
index 3c2daa300bf1989ec27744b8ba9620697da63600..0aa3ffb05e58550310f050f708ed06ebc1b95602 100644
(file)
--- a/
regress/hcommon.c
+++ b/
regress/hcommon.c
@@
-70,8
+70,8
@@
void Qpoll( const struct pollfd *fds , int nfds , int timeout ) {
void Qsocket( int domain , int type ) {
vb.used= 0;
Tvba("socket");
void Qsocket( int domain , int type ) {
vb.used= 0;
Tvba("socket");
- Tvbf(domain==
PF_INET ? " domain=P
F_INET" :
- domain==
PF_INET6 ? " domain=P
F_INET6" :
+ Tvbf(domain==
AF_INET ? " domain=A
F_INET" :
+ domain==
AF_INET6 ? " domain=A
F_INET6" :
" domain=AF_???");
Tvbf(type==SOCK_STREAM ? " type=SOCK_STREAM" : " type=SOCK_DGRAM");
Q_vb();
" domain=AF_???");
Tvbf(type==SOCK_STREAM ? " type=SOCK_STREAM" : " type=SOCK_DGRAM");
Q_vb();
@@
-167,6
+167,10
@@
void Tvbbytes(const void *buf, int len) {
void Tvbfdset(int max, const fd_set *fds) {
int i;
const char *comma= "";
void Tvbfdset(int max, const fd_set *fds) {
int i;
const char *comma= "";
+ if (!fds) {
+ Tvba("null");
+ return;
+ }
Tvba("[");
for (i=0; i<max; i++) {
if (!FD_ISSET(i,fds)) continue;
Tvba("[");
for (i=0; i<max; i++) {
if (!FD_ISSET(i,fds)) continue;
@@
-281,11
+285,11
@@
void *Hrealloc(void *op, size_t nsz) {
size_t osz;
if (op) { oldnode= (void*)((char*)op - MALLOCHSZ); osz= oldnode->sz; } else { osz= 0; }
np= Hmalloc(nsz);
size_t osz;
if (op) { oldnode= (void*)((char*)op - MALLOCHSZ); osz= oldnode->sz; } else { osz= 0; }
np= Hmalloc(nsz);
- memcpy(np,op, osz>nsz ? nsz : osz);
+
if (osz)
memcpy(np,op, osz>nsz ? nsz : osz);
Hfree(op);
return np;
}
Hfree(op);
return np;
}
-void
H
exit(int rv) {
+void
T
exit(int rv) {
struct malloced *loopnode;
Tshutdown();
adns__vbuf_free(&vb);
struct malloced *loopnode;
Tshutdown();
adns__vbuf_free(&vb);
@@
-299,6
+303,12
@@
void Hexit(int rv) {
}
exit(rv);
}
}
exit(rv);
}
+void Hexit(int rv) {
+ vb.used= 0;
+ Tvbf("exit %d", rv);
+ Q_vb();
+ Texit(0);
+}
pid_t Hgetpid(void) {
return 2264; /* just some number */
}
pid_t Hgetpid(void) {
return 2264; /* just some number */
}