fiorix / go-diameter

Diameter stack and Base Protocol (RFC 6733) for the Go programming language
Other
252 stars 143 forks source link

endless recursion when avp is not is found in the dictionary #200

Open MuhammadTalhaRao opened 2 months ago

MuhammadTalhaRao commented 2 months ago

In "/diam/dict/util.go" we try to find an avp and if we don't find it in its specific application and base dictionary the we get stuck in an endless loop. i fixed this issue for my library by adding a few checks but this issue need to fixed properly

if ok {
    return avp, nil
} else if appid != 0 {
    parentAppId, isScoppedApp := parentAppIds[appid]
    if isScoppedApp {
        // Try searching 'parent' dictionary
        appid = parentAppId
    } else {
        // Try searching the base dictionary.
        appid = 0
    }
    goto retry
} else {
          // here the endless recursion occurs

    if codeU32, isUint32 := code.(uint32); isUint32 {
        avp, err = p.FindAVP(origAppID, codeU32)
        if err != nil {
            return MakeUnknownAVP(origAppID, codeU32, vendorID), err
        }

        return avp, nil
    }
}