Commit ac23e47c authored by albert's avatar albert

pwdx: buffer overflow fixed -- thanks Ulf Harnhammar

parent d4a9781d
...@@ -5,6 +5,7 @@ top: terabytes -- thanks Tony Ernst ...@@ -5,6 +5,7 @@ top: terabytes -- thanks Tony Ernst
ps: SCHED_BATCH is B ps: SCHED_BATCH is B
ps: fix s format (signals) output with thread display ps: fix s format (signals) output with thread display
watch: avoid integer overflow for the time delay watch: avoid integer overflow for the time delay
pwdx: buffer overflow fixed -- thanks Ulf Harnhammar
procps-3.2.5 --> procps-3.2.6 procps-3.2.5 --> procps-3.2.6
......
...@@ -35,7 +35,7 @@ static void version(void) ...@@ -35,7 +35,7 @@ static void version(void)
int main(int argc, char* argv[]) int main(int argc, char* argv[])
{ {
char buf[PATH_MAX]; char buf[PATH_MAX+1];
regex_t re; regex_t re;
int i; int i;
...@@ -76,9 +76,9 @@ int main(int argc, char* argv[]) ...@@ -76,9 +76,9 @@ int main(int argc, char* argv[])
// or nnnn, so a simple check based on the first char is // or nnnn, so a simple check based on the first char is
// possible // possible
if (argv[i][0] != '/') if (argv[i][0] != '/')
sprintf(buf, "/proc/%s/cwd", argv[i]); snprintf(buf, sizeof buf, "/proc/%s/cwd", argv[i]);
else else
sprintf(buf, "%s/cwd", argv[i]); snprintf(buf, sizeof buf, "%s/cwd", argv[i]);
// buf contains /proc/nnnn/cwd symlink name on entry, the // buf contains /proc/nnnn/cwd symlink name on entry, the
// target of that symlink on return // target of that symlink on return
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment