diff options
Diffstat (limited to 'main.c')
-rw-r--r-- | main.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -137,8 +137,10 @@ void toy_exec(char *argv[]) if (!(which = toy_find(*argv))) return; // Return if stack depth getting noticeable (proxy for leaked heap, etc). - if (toys.stacktop && labs((char *)toys.stacktop-(char *)&which)>6000) - return; + + // Compiler writers have decided subtracting char * is undefined behavior, + // so convert to integers. (LP64 says sizeof(long)==sizeof(pointer).) + if (toys.stacktop && labs((long)toys.stacktop-(long)&which)>6000) return; // Return if we need to re-exec to acquire root via suid bit. if (toys.which && (which->flags&TOYFLAG_ROOTONLY) && toys.wasroot) return; |