Skip to content

Conversation

@aanderse
Copy link
Contributor

@aanderse aanderse commented Jul 2, 2025

https://github.com/troglobit/finit/blob/2760616c73af1284bd71ae9aa8226c3da3ff8544/src/service.c#L1420

prev and svc->args[...] are compared but prev has less bytes available than svc->args[...] does, which can result in truncated data being compared to determine if a service is dirty

for example:

service [234] name:mariadb restart:10 @mariadb:mariadb <!service/syslogd/ready,task/mariadb-init/success> notify:systemd log /nix/store/z5lmh4g28xxbdjc6zsblajw91fnmjd8d-mariadb-server-10.11.13/bin/mysqld --defaults-file=/etc/my.cnf --user=mariadb --datadir=/var/lib/mariadb --basedir=/nix/store/z5lmh4g28xxbdjc6zsblajw91fnmjd8d-mariadb-server-10.11.13 -- mariadb database service

this results in finit marking some of my services as dirty every time i run initctl reload

by giving prev the same size as what it will be compared against we can ensure a valid comparison

fully tested on my machine and ready to go 👍

Copy link
Collaborator

@troglobit troglobit left a comment

Choose a reason for hiding this comment

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

Nice catch!

@troglobit troglobit merged commit d42a1d4 into finit-project:master Jul 2, 2025
2 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