<pre style='margin:0'>
Clemens Lang (neverpanic) pushed a commit to branch master
in repository macports-base.
</pre>
<p><a href="https://github.com/macports/macports-base/commit/ca82940a64c872e1e1367b8891aeda5702fdd584">https://github.com/macports/macports-base/commit/ca82940a64c872e1e1367b8891aeda5702fdd584</a></p>
<pre style="white-space: pre; background: #F8F8F8"><span style='display:block; white-space:pre;color:#808000;'>commit ca82940a64c872e1e1367b8891aeda5702fdd584
</span>Author: Clemens Lang <neverpanic@gmail.com>
AuthorDate: Wed Sep 27 21:19:38 2023 +0200
<span style='display:block; white-space:pre;color:#404040;'> darwintrace: 0-initialize stat buffer
</span><span style='display:block; white-space:pre;color:#404040;'>
</span><span style='display:block; white-space:pre;color:#404040;'> During debugging I have seen cases where stat(2) did leave the mtime
</span><span style='display:block; white-space:pre;color:#404040;'> fields uninitialized, so make sure the entire struct is zeroized before
</span><span style='display:block; white-space:pre;color:#404040;'> calling stat(2) so that there is at least a useful value rather than
</span><span style='display:block; white-space:pre;color:#404040;'> reading from unitinialized memory.
</span>---
src/pextlib1.0/sip_copy_proc.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/src/pextlib1.0/sip_copy_proc.c b/src/pextlib1.0/sip_copy_proc.c
</span><span style='display:block; white-space:pre;color:#808080;'>index 7394d3fe0..61e1eab25 100644
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/src/pextlib1.0/sip_copy_proc.c
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/src/pextlib1.0/sip_copy_proc.c
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -381,8 +381,8 @@ static char *lazy_copy(const char *path, struct stat *in_st) {
</span>
// check whether copying is needed; it isn't if the file exists and the
// modification times match
<span style='display:block; white-space:pre;background:#ffe0e0;'>- struct stat out_st;
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- if ( -1 != stat(target_path, &out_st)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ struct stat out_st = {0};
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if (-1 != stat(target_path, &out_st)
</span> && in_st->st_mtimespec.tv_sec == out_st.st_mtimespec.tv_sec
&& in_st->st_mtimespec.tv_nsec == out_st.st_mtimespec.tv_nsec) {
// copying not needed
</pre><pre style='margin:0'>
</pre>