FreeBSD Bugzilla – Attachment 140167 Details for
Bug 186671
ports-mgmt/pkg 1.2.6 pkg version ignores index argument
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
pkg-version.patch.txt
pkg-version.patch.txt (text/plain; charset=US-ASCII), 1.37 KB, created by
mario.g.pavlov
on 2014-03-22 13:14:48 UTC
(
hide
)
Description:
pkg-version.patch.txt
Filename:
MIME Type:
Creator:
mario.g.pavlov
Created:
2014-03-22 13:14:48 UTC
Size:
1.37 KB
patch
obsolete
>diff --git a/src/version.c b/src/version.c >index 660ea83..a6a180c 100644 >--- a/src/version.c >+++ b/src/version.c >@@ -144,7 +144,7 @@ exec_version(int argc, char **argv) > unsigned int opt = 0; > int ch; > FILE *indexfile; >- char indexpath[MAXPATHLEN]; >+ char indexpath[MAXPATHLEN] = {'\0'}; > struct index_entry *indexhead = NULL; > struct utsname u; > int rel_major_ver; >@@ -243,6 +243,15 @@ exec_version(int argc, char **argv) > return (EX_USAGE); > } > } >+ if(optind < argc) { >+ size_t user_indexpath_len = strnlen(argv[optind], MAXPATHLEN); >+ if(MAXPATHLEN <= user_indexpath_len) { >+ fprintf(stderr, "The path length of your index file exceeds the maximum of %d characters.\n", MAXPATHLEN); >+ return (EX_IOERR); >+ } >+ strncpy(indexpath, argv[optind], user_indexpath_len); >+ } >+ > argc -= optind; > argv += optind; > >@@ -348,9 +357,12 @@ exec_version(int argc, char **argv) > goto cleanup; > > if (opt & VERSION_SOURCE_INDEX) { >- uname(&u); >- rel_major_ver = (int) strtol(u.release, NULL, 10); >- snprintf(indexpath, sizeof(indexpath), "%s/INDEX-%d", portsdir, rel_major_ver); >+ if(indexpath[0] == '\0') { >+ uname(&u); >+ rel_major_ver = (int) strtol(u.release, NULL, 10); >+ snprintf(indexpath, sizeof(indexpath), "%s/INDEX-%d", portsdir, rel_major_ver); >+ >+ } > indexfile = fopen(indexpath, "r"); > if (!indexfile) { > warnx("Unable to open %s!", indexpath);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 186671
:
140165
|
140166
| 140167