Skip to content

Instantly share code, notes, and snippets.

@kaworu
Created March 8, 2013 13:50
Show Gist options
  • Save kaworu/5116560 to your computer and use it in GitHub Desktop.
Save kaworu/5116560 to your computer and use it in GitHub Desktop.
Invalid read patch for pkg-ng. see https://github.com/pkgng/pkgng/issues/452
diff --git a/pkg/progressmeter.c b/pkg/progressmeter.c
index fddab1f..a33917c 100644
--- a/pkg/progressmeter.c
+++ b/pkg/progressmeter.c
@@ -183,7 +183,7 @@ refresh_progress_meter(void)
else
percent = 100;
- snprintf(buf + strlen(buf), win_size - strlen(buf-8),
+ snprintf(buf + strlen(buf), win_size - strlen(buf) - 8,
" %3d%% ", percent);
/* amount transferred */
@kaworu
Copy link
Author

kaworu commented Mar 8, 2013

In the context the expression buf - 8 seems to be an invalid read.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment