summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'dev-util/strace/files/strace-4.5.16-getdents-infinite-loop.patch')
-rw-r--r--dev-util/strace/files/strace-4.5.16-getdents-infinite-loop.patch26
1 files changed, 26 insertions, 0 deletions
diff --git a/dev-util/strace/files/strace-4.5.16-getdents-infinite-loop.patch b/dev-util/strace/files/strace-4.5.16-getdents-infinite-loop.patch
new file mode 100644
index 0000000..20bdcdf
--- /dev/null
+++ b/dev-util/strace/files/strace-4.5.16-getdents-infinite-loop.patch
@@ -0,0 +1,26 @@
+if the getdents struct is corrupt, strace will loop forever
+
+--- strace/file.c
++++ strace/file.c
+@@ -2414,6 +2414,10 @@ struct tcb *tcp;
+ #endif /* SUNOS4 */
+ i += d->d_reclen;
+ dents++;
++ if (!d->d_reclen) {
++ fprintf(stderr, "[error: d->d_reclen == 0] ");
++ break;
++ }
+ }
+ if (!abbrev(tcp))
+ tprintf("}");
+@@ -2466,6 +2470,10 @@ struct tcb * tcp;
+ }
+ i += d->d_reclen;
+ dents++;
++ if (!d->d_reclen) {
++ fprintf(stderr, "[error: d->d_reclen == 0] ");
++ break;
++ }
+ }
+ if (!abbrev(tcp))
+ tprintf("}");