Skip to content

Commit

Permalink
Handle index out of bound exceptions when parsing invalid messages
Browse files Browse the repository at this point in the history
  • Loading branch information
kapetan committed Apr 1, 2018
1 parent edf1eb8 commit 71df004
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions DNS/Client/ClientRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ public class ClientRequest : IRequest {
return response;
} catch (ArgumentException e) {
throw new ResponseException("Invalid response", e);
} catch (IndexOutOfRangeException e) {
throw new ResponseException("Invalid response", e);
}
}
}
Expand Down
1 change: 1 addition & 0 deletions DNS/Server/DnsServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ await udp
}
catch (SocketException e) { OnErrored(e); }
catch (ArgumentException e) { OnErrored(e); }
catch (IndexOutOfRangeException e) { OnErrored(e); }
catch (OperationCanceledException e) { OnErrored(e); }
catch (IOException e) { OnErrored(e); }
catch (ObjectDisposedException e) { OnErrored(e); }
Expand Down

0 comments on commit 71df004

Please sign in to comment.