| Summary: | Format string bug in procps/ps.c for non-Linux builds | ||
|---|---|---|---|
| Product: | Busybox | Reporter: | Matthias Andree <matthias.andree> |
| Component: | Other | Assignee: | unassigned |
| Status: | RESOLVED FIXED | ||
| Severity: | minor | CC: | busybox-cvs |
| Priority: | P5 | ||
| Version: | unspecified | ||
| Target Milestone: | --- | ||
| Hardware: | All | ||
| OS: | Other | ||
| Host: | Target: | ||
| Build: | |||
Fixed "%l" in git: commit 6aab061d2d6243505f7c21c7a92dcebc3922784c Author: Denys Vlasenko <vda.linux@googlemail.com> Date: Tue Jan 22 10:07:23 2013 +0100 ps: fix sscanf format specifier (%l); make uptime unsigned |
Compiling this on FreeBSD yields: CC procps/ps.o procps/ps.c: In function 'get_uptime': procps/ps.c:86: warning: conversion lacks type at end of format procps/ps.c:86: warning: too many arguments for format and indeed the format string is "%l" (ell) - this was probably meant to be "%li", "%ld", "%lx", or "%lo" - please fix. This would affect versions 1.20.2 and 1.21.0, and I have not checked older versions. It does not matter much because FreeBSD does not have /proc/uptime, so the function errors out before reaching the bug. On FreeBSD you get the uptime like this (see src/usr.bin/w/w.c): struct timespec tp; if (-1 != clock_gettime(CLOCK_MONOTONIC, &tp)) { /* process tp here */ }