Skip to content

Fix buffer overlap#145

Merged
LeandroMartinsdS merged 3 commits into
dls-masterfrom
fix_buffer_overlap
Aug 21, 2025
Merged

Fix buffer overlap#145
LeandroMartinsdS merged 3 commits into
dls-masterfrom
fix_buffer_overlap

Conversation

@LeandroMartinsdS
Copy link
Copy Markdown
Contributor

@LeandroMartinsdS LeandroMartinsdS commented Aug 15, 2025

This merge addresses a bug caused by buffer overlap in sprintf calls where the destination buffer was also used as a source (e.g., sprintf(command, "%s ...", command)). This led to string corruption during trajectory building for the PowerPMAC, when compiler optimisations were enabled.
The issue appeared when running from the ioc-pmac, due to the compiler being in later version compared to dev-container

Fix:

  • Replaced unsafe sprintf usage with snprintf and strncat to ensure safe string concatenation.

Impact:

  • Fixes unpredictable behaviour and corrupted trajectory commands.

Copy link
Copy Markdown
Contributor

@gilesknap gilesknap left a comment

Choose a reason for hiding this comment

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

Looks Good!

@LeandroMartinsdS
Copy link
Copy Markdown
Contributor Author

Added @shihab-dls for sharing knowledge of what's happening in pmac

@LeandroMartinsdS LeandroMartinsdS merged commit 7a4533a into dls-master Aug 21, 2025
@LeandroMartinsdS LeandroMartinsdS deleted the fix_buffer_overlap branch August 21, 2025 10:43
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