Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue148 - posting corrupt topic header in rare case (but common in tests.) #149

Merged
merged 4 commits into from
Jul 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion debian/changelog
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
metpx-sr3c (3.24.03rc1) unstable; urgency=medium
metpx-sr3c (3.24.07rc1) unstable; urgency=medium

* support #147 coreutils using syscall instead of renameat2 on redhat8 and
ubuntu 18.
* fix #148 sr3_cpost posting messages with corrupt topics if relPath blank.
* fix #141 sr3_cpost in a tree being mirrored (conflict with shim)
* tests: fix for link modification times cannot be preserved.
* test fixes for changes in python side.
Expand Down
14 changes: 8 additions & 6 deletions sr_post.c
Original file line number Diff line number Diff line change
Expand Up @@ -776,16 +776,18 @@ int sr_file2message_start(struct sr_context *sr_c, const char *pathspec,
s += pmatch[0].rm_eo;
}
}

// use tmprk variable to fix 255 AMQP_SS_LEN limit
strcpy(tmprk, sr_c->cfg->post_topicPrefix);
strcat(tmprk, ".");
strcat(tmprk, m->relPath + (*(m->relPath) == '/'));

if (strlen(tmprk) > 255)
tmprk[255] = '\0';

if ( strlen(m->relPath) > 0 ) {
strcat(tmprk, ".");
strcat(tmprk, m->relPath + ((strlen(m->relPath)>1)&&(*(m->relPath) == '/')));
if (strlen(tmprk) > 255)
tmprk[255] = '\0';
}
strcpy(m->routing_key, tmprk);


lasti = strlen(sr_c->cfg->post_topicPrefix);
for (int i = lasti; i < strlen(m->routing_key); i++) {
if (m->routing_key[i] == '/') {
Expand Down
Loading