[patch usr.bin/pkill/pkill.c malloc & memset => calloc

2014-05-06 Thread Peter Malone
(selected = malloc(nproc)) == NULL) + if ((selected = calloc(1, nproc)) == NULL) errx(STATUS_ERROR, "memory allocation failure"); - memset(selected, 0, nproc); /* * Refine the selection. -- Peter Malone

[patch sbin/iked/pfkey.c] replacing select with poll

2014-05-06 Thread Peter Malone
} - if (n == 0) { + if (ret == 0) { log_warnx("%s: no reply from PF_KEY", __func__); return (-1); } -- Peter Malone

Re: [patch sbin/nfsd/nfsd.c] replace malloc & memset with calloc

2014-04-24 Thread Peter Malone
Thanks Ted. I sent through another patch with timeout = -1. Passing INFTIM sounds like the best option though. Hopefully the rest checks out. On 04/24/14 20:30, Ted Unangst wrote: On Thu, Apr 24, 2014 at 19:27, Peter Malone wrote: The more I think about this. if we want to continue the

[patch parse.c] malloc & memset => calloc

2014-04-24 Thread Peter Malone
t;p = d->data; s->end = d->data + d->size; s->kindset = kindset; -- Peter Malone

[patch l2tp_ctrl.c] malloc & memset => calloc

2014-04-24 Thread Peter Malone
eturn (l2tp_ctrl *)_this; } -- Peter Malone

[patch l2tpd.c] malloc & memset => calloc

2014-04-24 Thread Peter Malone
listener)); L2TPD_ASSERT(sizeof(plistener->bind) >= addr->sa_len); memcpy(&plistener->bind, addr, addr->sa_len); -- Peter Malone

[patch usr.sbin/rtsold/rtsold.c] replace malloc & memset with calloc

2014-04-24 Thread Peter Malone
c__, "memory allocation failed"); free(sdl); return(-1); } - memset(ifinfo, 0, sizeof(*ifinfo)); ifinfo->sdl = sdl; strncpy(ifinfo->ifname, ifname, sizeof(ifinfo->ifname)); -- Peter Malone

Re: [patch sbin/nfsd/nfsd.c] replace malloc & memset with calloc

2014-04-24 Thread Peter Malone
(struct sockaddr *)&inetpeer, &len)) < 0) { On Thu, 24 Apr 2014 19:27:29 -0400 Peter Malone wrote: > The more I think about this. if we want to continue the select() > NULL functionality then timeout should be a negative value for poll(), > as NULL is unrecognized an

Re: [patch sbin/nfsd/nfsd.c] replace malloc & memset with calloc

2014-04-24 Thread Peter Malone
The more I think about this. if we want to continue the select() NULL functionality then timeout should be a negative value for poll(), as NULL is unrecognized and zero is a zero-length timeout. On 04/24/14 18:08, Peter Malone wrote: As promised. I cleaned up some of the code as well

Re: [patch sbin/nfsd/nfsd.c] replace malloc & memset with calloc

2014-04-24 Thread Peter Malone
f ((msgsock = accept(tcpsock, (struct sockaddr *)&inetpeer, &len)) < 0) { On Wed, 23 Apr 2014 21:56:56 -0400 Peter Malone wrote: > Sounds good. I'll work on that tomorrow afternoon/evening. > > > On 04/23/14 21:55, Ted Unangst wrot

Re: sudo alloc.c -- cleanup required?

2014-04-24 Thread Peter Malone
Great explanation - thanks. On 04/24/14 08:28, Todd C. Miller wrote: Sudo runs on more systems thsan just OpenBSD and so has a lot of configure goo and defines as a result. There's really no point in removing that. Any changes made to the sudo in OpenBSD just makes updates harder. The allo

Re: [patch src/usr.bin/mg/undo.c] replace malloc & memset with calloc

2014-04-24 Thread Peter Malone
On 04/24/14 04:09, Stuart Henderson wrote: On 2014/04/24 04:26, Miod Vallat wrote: Same as the others, this time with src/usr.bin/mg/undo.c You are now losing a memset() in the `rec doesn't come from malloc' code path. From the number and types of diff being sent, I am guessing these are tool

[patch usr.sbin/rwhod/rwhod.c] replace malloc & memset with calloc

2014-04-23 Thread Peter Malone
np->n_flags = flags; np->n_addr = (struct sockaddr *)(np + 1); np->n_addrlen = dstaddr->sa_len; -- Peter Malone

[patch usr.sbin/snmpd/mib.c] replace malloc & memset with calloc

2014-04-23 Thread Peter Malone
f, 0, sizeof(struct carpif)); memcpy(&cif->carpr, &carpr, sizeof(struct carpreq)); memcpy(&cif->kif, kif, sizeof(struct kif)); } -- Peter Malone

[patch src/usr.bin/mg/undo.c] replace malloc & memset with calloc

2014-04-23 Thread Peter Malone
NULL) panic("Out of memory in undo code (record)"); } - memset(rec, 0, sizeof(struct undo_rec)); return (rec); } -- Peter Malone

sudo alloc.c -- cleanup required?

2014-04-23 Thread Peter Malone
ct, most of alloc.c contains wrapper functions. Some are useful, like estrdup(), but could be implemented better (it calls the malloc wrapper). Any thoughts on this? -- Peter Malone

Re: [patch sbin/nfsd/nfsd.c] replace malloc & memset with calloc

2014-04-23 Thread Peter Malone
Sounds good. I'll work on that tomorrow afternoon/evening. On 04/23/14 21:55, Ted Unangst wrote: On Wed, Apr 23, 2014 at 21:38, Peter Malone wrote: Hi, Similar to the others. malloc & memset replacement with calloc, this time in sbin/nfsd/nfsd.c fd_size = howmany(maxsock + 1

Re: [patch bin/systrace/intercept.c] replace malloc & memset with calloc

2014-04-23 Thread Peter Malone
, 23 Apr 2014 21:35:59 -0400 Ted Unangst wrote: > On Wed, Apr 23, 2014 at 21:24, Peter Malone wrote: > > Hi, > > > > Similar to previous patches replacing malloc & memset with calloc, this > > time in src/bin/systrace/intercept.c > > > > > >

[patch sbin/nfsd/nfsd.c] replace malloc & memset with calloc

2014-04-23 Thread Peter Malone
if (tcpflag) FD_SET(tcpsock, sockbits); -- Peter Malone

[patch bin/systrace/intercept.c] replace malloc & memset with calloc

2014-04-23 Thread Peter Malone
me); - memcpy(tlnew, tl, sizeof(struct intercept_translate)); tlnew->off = offset; TAILQ_INSERT_TAIL(&tmp->tls, tlnew, next); -- Peter Malone intercept.c Description: Binary data

[patch bin/cp/utils.c] replace malloc & memset with calloc

2014-04-23 Thread Peter Malone
memset(zeroes, 0, MAXBSIZE); + err(1, "calloc"); } if ((from_fd = open(entp->fts_path, O_RDONLY, 0)) == -1) { -- Peter Malone utils.patch Description: Binary data

[patch ping.c] replace malloc & memset with calloc

2014-04-21 Thread Peter Malone
Hi, malloc & memset can be replaced with calloc in ping.c. Please see below for patch details: Index: ping.c === RCS file: /cvs/src/sbin/ping/ping.c,v retrieving revision 1.100 diff -u -p -u -r1.100 ping.c --- ping.c24 Mar 201

[patch dso_lib.c] replace malloc & memset with calloc

2014-04-21 Thread Peter Malone
Hi, Theo has been working on these patches over the past few days. I noticed an issue with dso_lib.c and fixed it accordingly. # cvs diff -u -r1.10 dso_lib.c Index: dso_lib.c === RCS file: /cvs/src/lib/libssl/src/crypto/dso/dso_li

Re: [patch] courier-imap-4.13 imapd patch replacing malloc, strcat and strcpy with asprintf

2014-04-20 Thread Peter Malone
That's it in a nutshell, essentially. I'll take a stab at it, until I get frustrated. Perhaps my time would be better suited to something else which could help OpenBSD. For the time being, however, I'll give this a shot. On 04/20/14 02:18, Maxime Villard wrote: Le 20/04/20

[patch] courier-imap-4.13 imapd patch replacing malloc, strcat and strcpy with asprintf

2014-04-19 Thread Peter Malone
Hi, I'm using OpenBSD 5.5. courier-imap-4.13 is in the ports tree and it's quite a mess. I started looking at it today with the hope of just replacing some of the malloc,strcat & strcpy calls with asprintf, but it became clear before long that there's lots more issues with this code. Regardless,