diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2012-05-16 12:23:58 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2012-05-16 12:23:58 +0200 |
commit | 8560ef291ca06948e5f49bccf4bf1e714654b718 (patch) | |
tree | deb55dc875c645b5fbf22265521396d3476c03fc /system.c | |
parent | 048cc42f08ac64a04d14e6de17611a5e7ec3b400 (diff) | |
download | strace-8560ef291ca06948e5f49bccf4bf1e714654b718.tar.gz strace-8560ef291ca06948e5f49bccf4bf1e714654b718.tar.bz2 strace-8560ef291ca06948e5f49bccf4bf1e714654b718.tar.xz |
Fix a few goofs in sys_sysctl()
* system.c (sys_sysctl): Cast pointer to long, not size_t,
when we intend to use it as an address. Set oldlen to 0 prior
to reading into it - we want to have deterministic result
if read fails.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'system.c')
-rw-r--r-- | system.c | 5 |
1 files changed, 2 insertions, 3 deletions
@@ -951,8 +951,8 @@ sys_sysctl(struct tcb *tcp) tprints(", ..."); tprintf("}, %d, ", info.nlen); } else { - size_t oldlen; - if (umove(tcp, (size_t)info.oldlenp, &oldlen) >= 0 + size_t oldlen = 0; + if (umove(tcp, (long)info.oldlenp, &oldlen) >= 0 && info.nlen >= 2 && ((name[0] == CTL_KERN && (name[1] == KERN_OSRELEASE @@ -978,7 +978,6 @@ sys_sysctl(struct tcb *tcp) info.oldval, (unsigned long)oldlen, info.newval, (unsigned long)info.newlen); } - tprints("}"); } free(name); |