From b91bb8ba71ddac8cb44eb931259a903c0db3ef54 Mon Sep 17 00:00:00 2001 From: David Evans Date: Fri, 18 Feb 2022 22:04:47 -0800 Subject: [PATCH] Soundness --- .../NIOIMAPCore/Grammar/Message/MessageAttributes.swift | 6 +++--- .../Parser/Grammar/GrammarParser+Message.swift | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Sources/NIOIMAPCore/Grammar/Message/MessageAttributes.swift b/Sources/NIOIMAPCore/Grammar/Message/MessageAttributes.swift index fb9d1b35f..f8cce515c 100644 --- a/Sources/NIOIMAPCore/Grammar/Message/MessageAttributes.swift +++ b/Sources/NIOIMAPCore/Grammar/Message/MessageAttributes.swift @@ -28,11 +28,11 @@ public enum MessageAttribute: Hashable { case uid(UID) /// `RFC822.SIZE` -- A number expressing the RFC 2822 size of the message. case rfc822Size(Int) - + case rfc822(ByteBuffer?) - + case rfc822Text(ByteBuffer?) - + case rfc822Header(ByteBuffer?) /// `BODYSTRUCTURE` or `BODY` -- A list that describes the MIME body structure of a message. diff --git a/Sources/NIOIMAPCore/Parser/Grammar/GrammarParser+Message.swift b/Sources/NIOIMAPCore/Parser/Grammar/GrammarParser+Message.swift index 6a837da89..29cc94548 100644 --- a/Sources/NIOIMAPCore/Parser/Grammar/GrammarParser+Message.swift +++ b/Sources/NIOIMAPCore/Parser/Grammar/GrammarParser+Message.swift @@ -177,17 +177,17 @@ extension GrammarParser { try PL.parseFixedString(")", buffer: &buffer, tracker: tracker) return .gmailLabels(attributes) } - + func parseMessageAttribute_rfc822(buffer: inout ParseBuffer, tracker: StackTracker) throws -> MessageAttribute { try PL.parseSpaces(buffer: &buffer, tracker: tracker) return .rfc822(try self.parseNString(buffer: &buffer, tracker: tracker)) } - + func parseMessageAttribute_rfc822Text(buffer: inout ParseBuffer, tracker: StackTracker) throws -> MessageAttribute { try PL.parseSpaces(buffer: &buffer, tracker: tracker) return .rfc822Text(try self.parseNString(buffer: &buffer, tracker: tracker)) } - + func parseMessageAttribute_rfc822Header(buffer: inout ParseBuffer, tracker: StackTracker) throws -> MessageAttribute { try PL.parseSpaces(buffer: &buffer, tracker: tracker) return .rfc822Header(try self.parseNString(buffer: &buffer, tracker: tracker)) @@ -206,7 +206,7 @@ extension GrammarParser { "X-GM-THRID": parseMessageAttribute_gmailThreadID, "X-GM-LABELS": parseMessageAttribute_gmailLabels, "MODSEQ": parseMessageAttribute_fetchModifierResponse, - + // note the order matters here // RFC822 needs to be the *last* attempted out of // all of the RFC822.* options, as RFC822.SIZE will