From 1309c84a3cf837d0c57033f7eb5734a0556b1f49 Mon Sep 17 00:00:00 2001 From: Darryl Pogue Date: Mon, 30 Sep 2024 22:43:45 -0700 Subject: [PATCH] Replace fputc with ungetc to fix UB Closes #185. --- streams.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/streams.cpp b/streams.cpp index 5def001..00bf446 100644 --- a/streams.cpp +++ b/streams.cpp @@ -155,7 +155,7 @@ uint32_t DS::FileStream::size() const bool DS::FileStream::atEof() { int ch = fgetc(m_file); - fputc(ch, m_file); + ungetc(ch, m_file); return (ch == EOF); }