Skip to content

Commit 41732e5

Browse files
committed
Guard against empty qType and return codes
1 parent 1c3faf6 commit 41732e5

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

dnscrypt-proxy/plugin_nx_log.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ func (plugin *PluginNxLog) Eval(pluginsState *PluginsState, msg *dns.Msg) error
5252
question := msg.Question[0]
5353
qType, ok := dns.TypeToString[question.Qtype]
5454
if !ok {
55-
qType = string(qType)
55+
qType = fmt.Sprintf("%d", question.Qtype)
5656
}
5757
qName := pluginsState.qName
5858

dnscrypt-proxy/plugin_query_log.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ func (plugin *PluginQueryLog) Eval(pluginsState *PluginsState, msg *dns.Msg) err
5252
question := msg.Question[0]
5353
qType, ok := dns.TypeToString[question.Qtype]
5454
if !ok {
55-
qType = string(qType)
55+
qType = fmt.Sprintf("%d", question.Qtype)
5656
}
5757
if len(plugin.ignoredQtypes) > 0 {
5858
for _, ignoredQtype := range plugin.ignoredQtypes {
@@ -73,7 +73,7 @@ func (plugin *PluginQueryLog) Eval(pluginsState *PluginsState, msg *dns.Msg) err
7373
}
7474
returnCode, ok := PluginsReturnCodeToString[pluginsState.returnCode]
7575
if !ok {
76-
returnCode = string(returnCode)
76+
returnCode = fmt.Sprintf("%d", pluginsState.returnCode)
7777
}
7878

7979
var requestDuration time.Duration

0 commit comments

Comments
 (0)