[Bug 266036] valgrind reporting invalid read/write for setproctitle

From: <bugzilla-noreply_at_freebsd.org>
Date: Thu, 25 Aug 2022 15:44:58 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=266036

            Bug ID: 266036
           Summary: valgrind reporting invalid read/write for setproctitle
           Product: Base System
           Version: 13.1-RELEASE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: bin
          Assignee: bugs@FreeBSD.org
          Reporter: sdalu@sdalu.com

Created attachment 236113
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=236113&action=edit
valgrind log

When building the following and running it under valgrind invalid read/write
are reported.

=== spt.c ===
#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>

int main() {
    char *a = "http/caldav", *b = "[unix socket]", *c = "sdalu@sdalu.com", *d =
"", *e = "GET";
    printf("%s %s %s %s %s\n", a, b, c, d, e);
    setproctitle("%s %s %s %s %s", a, b, c, d, e);
    return 0;
}
=== spt.c ===

cc spt.c -o spt
valgrind ./spt


log (full log in attachement):
==98938== Invalid read of size 8
==98938==    at 0x490457C: ??? (in /lib/libc.so.7)
==98938==    by 0x4904778: setproctitle (in /lib/libc.so.7)
==98938==    by 0x2019DE: main (in /root/spt)
==98938==  Address 0x7fffffffefe0 is not stack'd, malloc'd or (recently) free'd
==98938== 
==98938== Invalid read of size 4
==98938==    at 0x49045AE: ??? (in /lib/libc.so.7)
==98938==    by 0x4904778: setproctitle (in /lib/libc.so.7)
==98938==    by 0x2019DE: main (in /root/spt)
==98938==  Address 0x7fffffffefe8 is not stack'd, malloc'd or (recently) free'd



Original discussion:
https://github.com/cyrusimap/cyrus-imapd/issues/4216#issuecomment-1227421667

-- 
You are receiving this mail because:
You are the assignee for the bug.