No extra newlines in the error messages. [rsc] --rw-rw-r-- M 249245 glenda sys 11255 Sep 17 11:36 acme/mail/src/mail.c /n/sourcesdump/2005/0917/plan9/acme/mail/src/mail.c:151,157 - /n/sourcesdump/2005/0918/plan9/acme/mail/src/mail.c:151,157 s = estrstrdup(maildir, "ctl"); mbox.ctlfd = open(s, ORDWR|OCEXEC); if(mbox.ctlfd < 0) - error("can't open %s: %r\n", s); + error("can't open %s: %r", s); fsname = estrdup(name); if(newdir && argc > 0){ /n/sourcesdump/2005/0917/plan9/acme/mail/src/mail.c:163,169 - /n/sourcesdump/2005/0918/plan9/acme/mail/src/mail.c:163,169 err[0] = '\0'; errstr(err, sizeof err); if(strstr(err, "mbox name in use") == nil) - error("can't create directory %s for mail: %s\n", name, err); + error("can't create directory %s for mail: %s", name, err); free(fsname); fsname = emalloc(strlen(name)+10); sprint(fsname, "%s-%d", name, i); [rsc] --rw-rw-r-- M 249245 glenda sys 26290 Sep 17 11:36 acme/mail/src/mesg.c /n/sourcesdump/2005/0917/plan9/acme/mail/src/mesg.c:533,539 - /n/sourcesdump/2005/0918/plan9/acme/mail/src/mesg.c:533,539 Message *n, *next; if(m->opened) - error("internal error: deleted message still open in mesgdel\n"); + error("internal error: deleted message still open in mesgdel"); /* delete subparts */ for(n=m->head; n!=nil; n=next){ next = n->next; [sys] --rwxrwxr-x M 249245 rsc sys 179106 Sep 17 23:09 acme/bin/386/Mail /acme/mail/src/mail.c:mainctl /acme/mail/src/mail.c:mboxcommand /acme/mail/src/mail.c:plumbproc /acme/mail/src/mail.c:plumbsendproc /acme/mail/src/mail.c:plumbsendthread /acme/mail/src/mail.c:plumbshowproc /acme/mail/src/mail.c:plumbshowthread /acme/mail/src/mail.c:plumbthread /acme/mail/src/mail.c:showmesg /acme/mail/src/mail.c:threadmain /acme/mail/src/mesg.c:expandaddr /acme/mail/src/mesg.c:ext /acme/mail/src/mesg.c:isemail /acme/mail/src/mesg.c:mesgcommand /acme/mail/src/mesg.c:mesgctl /acme/mail/src/mesg.c:mesgline /acme/mail/src/mesg.c:mesgload /acme/mail/src/mesg.c:mesglookup /acme/mail/src/mesg.c:mesgopen /acme/mail/src/mesg.c:mesgsave /acme/mail/src/mesg.c:mesgtagpost /acme/mail/src/mesg.c:mimedisplay /acme/mail/src/mesg.c:plumb /acme/mail/src/mesg.c:printheader /acme/mail/src/mesg.c:replytoaddr /acme/mail/src/mesg.c:rewritembox Describe the "port" file. [rsc] --rw-rw-r-- M 249245 glenda sys 6960 Sep 17 11:37 sys/man/3/usb /n/sourcesdump/2005/0917/plan9/sys/man/3/usb:201,206 - /n/sourcesdump/2005/0918/plan9/sys/man/3/usb:201,209 .SH FILES .TF "#U/usb n /*/status" .TP + .BI #U/usb n /port + USB port status file; for each port, space separated: port number, hexadecimal port status, port status string + .TP .BI #U/usb n /*/status USB device status file; class/subclass/proto, vendor-id and product-id are found in line one .TP Leak less memory. [rsc] --rw-rw-r-- M 249245 glenda sys 54895 Sep 17 11:38 sys/src/libsec/port/tlshand.c /n/sourcesdump/2005/0917/plan9/sys/src/libsec/port/tlshand.c:2068,2076 - /n/sourcesdump/2005/0918/plan9/sys/src/libsec/port/tlshand.c:2068,2079 uchar *a; Bytes* ans; + a = nil; n = (mpsignif(big)+7)/8; m = mptobe(big, nil, n, &a); ans = makebytes(a, m); + if(a != nil) + free(a); return ans; } [rsc] --rw-rw-r-- M 249245 glenda sys 50653 Sep 17 11:39 sys/src/libsec/port/x509.c /n/sourcesdump/2005/0917/plan9/sys/src/libsec/port/x509.c:1459,1465 - /n/sourcesdump/2005/0918/plan9/sys/src/libsec/port/x509.c:1459,1465 freeints(v->u.objidval); break; case VString: - if (v->u.stringval) + if(v->u.stringval) free(v->u.stringval); break; case VSeq: /n/sourcesdump/2005/0917/plan9/sys/src/libsec/port/x509.c:1466,1472 - /n/sourcesdump/2005/0918/plan9/sys/src/libsec/port/x509.c:1466,1472 el = v->u.seqval; for(l = el; l != nil; l = l->tl) freevalfields(&l->hd.val); - if (el) + if(el) freeelist(el); break; case VSet: /n/sourcesdump/2005/0917/plan9/sys/src/libsec/port/x509.c:1473,1479 - /n/sourcesdump/2005/0918/plan9/sys/src/libsec/port/x509.c:1473,1479 el = v->u.setval; for(l = el; l != nil; l = l->tl) freevalfields(&l->hd.val); - if (el) + if(el) freeelist(el); break; } /n/sourcesdump/2005/0917/plan9/sys/src/libsec/port/x509.c:1598,1604 - /n/sourcesdump/2005/0918/plan9/sys/src/libsec/port/x509.c:1598,1604 static void freecert(CertX509* c) { - if (!c) return; + if(!c) return; if(c->issuer != nil) free(c->issuer); if(c->validity_start != nil) /n/sourcesdump/2005/0917/plan9/sys/src/libsec/port/x509.c:1609,1614 - /n/sourcesdump/2005/0918/plan9/sys/src/libsec/port/x509.c:1609,1615 free(c->subject); freebytes(c->publickey); freebytes(c->signature); + free(c); } /* /n/sourcesdump/2005/0917/plan9/sys/src/libsec/port/x509.c:1831,1845 - /n/sourcesdump/2005/0918/plan9/sys/src/libsec/port/x509.c:1832,1849 decode_rsapubkey(Bytes* a) { Elem e; - Elist *el; + Elist *el, *l; mpint *mp; RSApub* key; + l = nil; key = rsapuballoc(); if(decode(a->data, a->len, &e) != ASN_OK) goto errret; if(!is_seq(&e, &el) || elistlen(el) != 2) goto errret; + + l = el; key->n = mp = asn1mpint(&el->hd); if(mp == nil) /n/sourcesdump/2005/0917/plan9/sys/src/libsec/port/x509.c:1849,1856 - /n/sourcesdump/2005/0918/plan9/sys/src/libsec/port/x509.c:1853,1865 key->ek = mp = asn1mpint(&el->hd); if(mp == nil) goto errret; + + if(l != nil) + freeelist(l); return key; errret: + if(l != nil) + freeelist(l); rsapubfree(key); return nil; } /n/sourcesdump/2005/0917/plan9/sys/src/libsec/port/x509.c:2003,2010 - /n/sourcesdump/2005/0918/plan9/sys/src/libsec/port/x509.c:2012,2022 p+length < p) return; info = p; - if(ber_decode(&p, pend, &elem) != ASN_OK || elem.tag.num != SEQUENCE) + if(ber_decode(&p, pend, &elem) != ASN_OK) return; + freevalfields(&elem.val); + if(elem.tag.num != SEQUENCE) + return; infolen = p - info; (*digestfun)(info, infolen, digest, nil); } /n/sourcesdump/2005/0917/plan9/sys/src/libsec/port/x509.c:2019,2025 - /n/sourcesdump/2005/0918/plan9/sys/src/libsec/port/x509.c:2031,2041 int buflen; mpint *pkcs1; int nlen; + char *err; + err = nil; + pkcs1buf = nil; + /* one less than the byte length of the modulus */ nlen = (mpsignif(pk->n)-1)/8; /n/sourcesdump/2005/0917/plan9/sys/src/libsec/port/x509.c:2029,2050 - /n/sourcesdump/2005/0918/plan9/sys/src/libsec/port/x509.c:2045,2079 pkcs1buf = nil; buflen = mptobe(pkcs1, nil, 0, &pkcs1buf); buf = pkcs1buf; - if(buflen != nlen || buf[0] != 1) - return "expected 1"; + if(buflen != nlen || buf[0] != 1) { + err = "expected 1"; + goto end; + } buf++; while(buf[0] == 0xff) buf++; - if(buf[0] != 0) - return "expected 0"; + if(buf[0] != 0) { + err = "expected 0"; + goto end; + } buf++; buflen -= buf-pkcs1buf; if(decode(buf, buflen, &e) != ASN_OK || !is_seq(&e, &el) || elistlen(el) != 2 || - !is_octetstring(&el->tl->hd, &digest)) - return "signature parse error"; + !is_octetstring(&el->tl->hd, &digest)) { + err = "signature parse error"; + goto end; + } *psigalg = &el->hd; if(memcmp(digest->data, edigest, digest->len) == 0) - return nil; - return "digests did not match"; + goto end; + err = "digests did not match"; + + end: + if(pkcs1 != nil) + mpfree(pkcs1); + if(pkcs1buf != nil) + free(pkcs1buf); + return err; } RSApub* [sys] --rwxrwxr-x M 249245 glenda sys 232667 Sep 17 23:09 386/bin/hget [sys] --rwxrwxr-x M 249245 glenda sys 471908 Sep 17 23:09 386/bin/vncs [sys] --rwxrwxr-x M 249245 glenda sys 518730 Sep 17 23:09 386/bin/vncv [sys] --rwxrwxr-x M 249245 glenda sys 272234 Sep 17 23:09 386/bin/ftpfs [sys] --rwxrwxr-x M 249245 glenda sys 349999 Sep 17 23:09 386/bin/webfs /sys/src/libsec/port/tlshand.c:mptobytes /sys/src/libsec/port/x509.c:decode_rsapubkey /sys/src/libsec/port/x509.c:digest_certinfo /sys/src/libsec/port/x509.c:freecert /sys/src/libsec/port/x509.c:verify_signature [sys] --rwxrwxr-x M 249245 rsc sys 119856 Sep 17 23:09 386/bin/auth/asn12rsa [sys] --rwxrwxr-x M 249245 rsc sys 179931 Sep 17 23:09 386/bin/auth/rsa2csr [sys] --rwxrwxr-x M 249245 rsc sys 183692 Sep 17 23:09 386/bin/auth/rsa2x509 /sys/src/libsec/port/x509.c:decode_rsapubkey /sys/src/libsec/port/x509.c:digest_certinfo /sys/src/libsec/port/x509.c:freecert /sys/src/libsec/port/x509.c:verify_signature [sys] --rwxrwxr-x M 249245 glenda sys 291029 Sep 17 23:09 386/bin/ip/httpd/httpd [sys] --rwxrwxr-x M 249245 rsc sys 197885 Sep 17 23:09 386/bin/tlsclient [sys] --rwxrwxr-x M 249245 glenda sys 198123 Sep 17 23:09 386/bin/tlssrv [sys] --rwxrwxr-x M 249245 glenda sys 333054 Sep 17 23:09 386/bin/upas/fs [sys] --rwxrwxr-x M 249245 glenda sys 260589 Sep 17 23:09 386/bin/upas/pop3 [sys] --rwxrwxr-x M 249245 glenda sys 274558 Sep 17 23:09 386/bin/upas/smtp [sys] --rwxrwxr-x M 249245 glenda sys 329607 Sep 17 23:09 386/bin/upas/smtpd /sys/src/libsec/port/tlshand.c:mptobytes /sys/src/libsec/port/x509.c:decode_rsapubkey /sys/src/libsec/port/x509.c:digest_certinfo /sys/src/libsec/port/x509.c:freecert /sys/src/libsec/port/x509.c:verify_signature [sys] --rw-rw-r-- M 249245 glenda sys 645922 Sep 17 23:09 386/lib/libsec.a