Skip to content

Conversation

@jakub-id
Copy link
Contributor

@jakub-id jakub-id commented Jan 9, 2026

AI fixes so the logic might be off

AI fixes so the logic might be off
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request addresses deprecation warnings in macOS by replacing unsafe sprintf calls with bounds-checked snprintf calls throughout the codebase. The changes also include minor corrections to format specifiers and removal of trailing whitespace.

Key changes:

  • Replaced all sprintf calls with snprintf to prevent buffer overflows
  • Updated buffer size calculations to include space for null terminators
  • Changed format specifier from %d to %u for unsigned integer at line 1103 in filter_zoom.cpp
  • Removed trailing blank lines from multiple source files

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/metaproxy_prog.cpp Replaced sprintf with snprintf using sizeof operator for PID logging
src/filter_zoom.cpp Replaced multiple sprintf calls with snprintf, added buffer size calculations, but introduced two critical buffer overflow bugs due to incorrect variable usage in size calculations
src/filter_record_transform.cpp Replaced sprintf with snprintf for error message formatting
src/filter_cgi.cpp Replaced sprintf with snprintf using sizeof operator for content length
src/filter_backend_test.cpp Replaced sprintf with snprintf using sizeof operator for record offset generation

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

@adamdickmeiss adamdickmeiss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It hurts.. 30 is plenty enough for formatting %d and that's with extra +1 . But in general this is just bad code, from my part. I will make an odr_printf .. function which can be used for all of this. It will be shorter and readable.

@jakub-id
Copy link
Contributor Author

jakub-id commented Jan 9, 2026

@adamdickmeiss yeah, all the malloc/snprintf bits should probably use a shared size variable rather than repeat the hard-coded sizes.

Is there no way to have a wrapper for this thing or use some "safe" string concat? C coding hurts :)

jakub-id and others added 2 commits January 9, 2026 11:15
Co-authored-by: Adam Dickmeiss <adam@indexdata.dk>
@adamdickmeiss adamdickmeiss self-requested a review January 9, 2026 14:05
Copy link
Contributor

@adamdickmeiss adamdickmeiss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some constructs would be simpler with nmem_printf.
@jakub-id can you see if this makes removes the warnings on macOS.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@adamdickmeiss adamdickmeiss merged commit d09d4ae into master Jan 9, 2026
2 checks passed
@adamdickmeiss adamdickmeiss deleted the deprecations-macos branch January 10, 2026 19:27
@jakub-id
Copy link
Contributor Author

Some constructs would be simpler with nmem_printf.
@jakub-id can you see if this makes removes the warnings on macOS.

@adamdickmeiss will test today

@jakub-id
Copy link
Contributor Author

Some constructs would be simpler with nmem_printf.
@jakub-id can you see if this makes removes the warnings on macOS.

@adamdickmeiss will test today

warnings now gone

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants