Changeset 406a2f4 in rtems-libbsd


Ignore:
Timestamp:
Jan 23, 2014, 1:59:37 PM (6 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, c1e05b9ea378b2971e3d7704779112b4bc4296da, freebsd-9.3, 4a77611a223ea883fb548679b516d326a020d447
Children:
7222726
Parents:
3951c97
git-author:
Sebastian Huber <sebastian.huber@…> (01/23/14 13:59:37)
git-committer:
Sebastian Huber <sebastian.huber@…> (01/30/14 15:23:04)
Message:

mDNS: AnonInfoAnswersQuestion?: Fix stack usage

The mDNSexport is normally defined to be empty, thus mDNSStorage is a
huge stack variable (roughly 50KiB) with random data.

Asuming a global mDNSStorage variable in the mDNSCore makes no sense.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • mDNSResponder/mDNSCore/anonymous.c

    r3951c97 r406a2f4  
    250250}
    251251
     252mDNSlocal char *RRDisplayStringBuf(const ResourceRecord *const rr, char *const buffer)
     253{
     254    return GetRRDisplayString_rdb(rr, &rr->rdata->u, buffer);
     255}
     256
    252257// returns -1 if the caller should ignore the result
    253258// returns 1 if the record answers the question
     
    255260mDNSexport int AnonInfoAnswersQuestion(const ResourceRecord *const rr, const DNSQuestion *const q)
    256261{
    257     mDNSexport mDNS mDNSStorage;
     262    char MsgBuffer[MaxMsg];             // Temp storage used while building error log messages
    258263    ResourceRecord *nsec3RR;
    259264    int i;
     
    338343        {
    339344            debugf("AnonInfoAnswersQuestion: AnonData mis-match for record  %s question %##s ",
    340                 RRDisplayString(&mDNSStorage, rr), q->qname.c);
     345                RRDisplayStringBuf(rr, MsgBuffer), q->qname.c);
    341346            return 0;
    342347        }
     
    376381        // that too and we can end up here for that case.
    377382        debugf("AnonInfoAnswersQuestion: AnonData %p or nsec3RR %p, NULL for question %##s, record %s", AnonData, nsec3RR,
    378             q->qname.c, RRDisplayString(&mDNSStorage, rr));
     383            q->qname.c, RRDisplayStringBuf(rr, MsgBuffer));
    379384        return 0;
    380385    }
    381     debugf("AnonInfoAnswersQuestion: Validating question %##s, ResourceRecord %s", q->qname.c, RRDisplayString(&mDNSStorage, nsec3RR));
     386    debugf("AnonInfoAnswersQuestion: Validating question %##s, ResourceRecord %s", q->qname.c, RRDisplayStringBuf(nsec3RR, MsgBuffer));
    382387
    383388
     
    411416        }
    412417    }
    413     LogInfo("AnonInfoAnswersQuestion: ResourceRecord %s matched question %##s (%s)", RRDisplayString(&mDNSStorage, nsec3RR), q->qname.c, DNSTypeName(q->qtype));
     418    LogInfo("AnonInfoAnswersQuestion: ResourceRecord %s matched question %##s (%s)", RRDisplayStringBuf(nsec3RR, MsgBuffer), q->qname.c, DNSTypeName(q->qtype));
    414419    return 1;
    415420}
Note: See TracChangeset for help on using the changeset viewer.