diff options
author | 2016-05-14 14:24:54 +0000 | |
---|---|---|
committer | 2016-05-14 14:24:54 +0000 | |
commit | cd70aa850ff2333538335abe783ca388961e3c94 (patch) | |
tree | cd821aa049b01f3eb23dc7707f583160c1630ea0 /lib/libkvm/kvm.c | |
parent | add 6.1 firmware key (diff) | |
download | wireguard-openbsd-cd70aa850ff2333538335abe783ca388961e3c94.tar.xz wireguard-openbsd-cd70aa850ff2333538335abe783ca388961e3c94.zip |
Revert previous commit. Converting bcopy into memcpy is never safe when
there is a big fat comment saying "Avoid alignment issues" immediately
above them.
Diffstat (limited to 'lib/libkvm/kvm.c')
-rw-r--r-- | lib/libkvm/kvm.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/libkvm/kvm.c b/lib/libkvm/kvm.c index aa5fc42edb1..a2f699dbbd6 100644 --- a/lib/libkvm/kvm.c +++ b/lib/libkvm/kvm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kvm.c,v 1.60 2016/05/11 17:46:44 tedu Exp $ */ +/* $OpenBSD: kvm.c,v 1.61 2016/05/14 14:24:54 kettenis Exp $ */ /* $NetBSD: kvm.c,v 1.43 1996/05/05 04:31:59 gwr Exp $ */ /*- @@ -713,7 +713,7 @@ kvm_dbopen(kvm_t *kd, const char *uf) if (rec.data == 0 || rec.size > sizeof(dbversion)) goto close; - memcpy(dbversion, rec.data, rec.size); + bcopy(rec.data, dbversion, rec.size); dbversionlen = rec.size; /* @@ -727,7 +727,7 @@ kvm_dbopen(kvm_t *kd, const char *uf) goto close; if (rec.data == 0 || rec.size != sizeof(struct nlist)) goto close; - memcpy(&nitem, rec.data, sizeof(nitem)); + bcopy(rec.data, &nitem, sizeof(nitem)); if (kvm_read(kd, (u_long)nitem.n_value, kversion, dbversionlen) != dbversionlen) goto close; @@ -791,10 +791,10 @@ kvm_nlist(kvm_t *kd, struct nlist *nl) /* * Avoid alignment issues. */ - memcpy(&p->n_type, &((struct nlist *)rec.data)->n_type, - sizeof(p->n_type)); - memcpy(&p->n_value, &((struct nlist *)rec.data)->n_value, - sizeof(p->n_value)); + bcopy(&((struct nlist *)rec.data)->n_type, + &p->n_type, sizeof(p->n_type)); + bcopy(&((struct nlist *)rec.data)->n_value, + &p->n_value, sizeof(p->n_value)); } /* * Return the number of entries that weren't found. |