Skip to content

Conversation

@AlanRuno
Copy link
Owner

@AlanRuno AlanRuno commented Jan 17, 2026

Summary

This PR fixes two CI issues:

1. Lint fix (sprintf → snprintf):
Replaces unsafe sprintf calls with snprintf to satisfy the CI lint check that flags printf-family functions as potentially unsafe. This is a mechanical change with no functional impact.

Files changed:

  • src/mxd_http_api.c - 5 sprintf → snprintf replacements for block hash and address hex conversion
  • src/blockchain/mxd_rsc.c - 4 sprintf → snprintf replacements for genesis address logging

All buffer sizes are verified correct:

  • 129 bytes for 64-byte hashes (128 hex chars + null terminator)
  • 41 bytes for 20-byte addresses (40 hex chars + null terminator)
  • snprintf size of 3 per iteration (2 hex chars + null, which gets overwritten by next iteration)

2. Docker build fix:
Adds missing libmicrohttpd dependency that was causing docker-build CI to fail with "No package 'libmicrohttpd' found".

Dockerfile changes:

  • Builder stage: added libmicrohttpd-dev
  • Runtime stage: added libmicrohttpd12 and curl (curl needed for existing healthcheck)

Review & Testing Checklist for Human

  • Verify the snprintf size parameter 3 is correct for the "%02x" format (writes 2 chars + null per byte)
  • Verify docker-build CI passes with the new dependencies
  • Test Docker image builds and runs correctly (healthcheck uses curl)

Test plan:

  1. Verify gcc lint check passes in CI
  2. Verify docker-build job passes in CI
  3. Optionally: docker build . locally and verify the image starts

Notes

Link to Devin run: https://app.devin.ai/sessions/f0a6357d898e440ea3745d77dfb91d8d
Requested by: Runo (runonetworks@gmail.com) / @AlanRuno

Replace unsafe sprintf calls with snprintf to satisfy the lint check
that flags printf-family functions as potentially unsafe. All buffer
sizes are verified to be correct (129 for 64-byte hashes, 41 for
20-byte addresses).
@devin-ai-integration
Copy link

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

Add libmicrohttpd-dev to builder stage and libmicrohttpd12 to runtime
stage. Also add curl to runtime stage for healthcheck.
@devin-ai-integration devin-ai-integration bot changed the title Fix lint: replace sprintf with snprintf for hex conversion Fix lint and docker-build: sprintf→snprintf + add libmicrohttpd Jan 18, 2026
@AlanRuno AlanRuno merged commit b16742b into main Jan 18, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants