Index: src/drl_installer.c =================================================================== --- src/drl_installer.c (revision 63) +++ src/drl_installer.c (working copy) @@ -42,6 +42,8 @@ // http://linux.redos.si/DroplineVersions // http://droplinegnome.org/DroplineFiles2.16 +#define MAX_VERSIONS 127 + void *la (int fd) {}; /* @@ -58,7 +60,7 @@ struct HttpRequest *r; DownloadState *ow; struct PkgList *db; - char **packages, *versions[128],*mirror = "http://heanet.dl.sourceforge.net/sourceforge/dropline-gnome/"; + char **packages, *versions[MAX_VERSIONS+1],*mirror = "http://heanet.dl.sourceforge.net/sourceforge/dropline-gnome/"; char *request, *homedir; int i; int fd, c = 0, xfd; @@ -86,7 +88,7 @@ dlg_recv_versions ( ); - if (dlg_read_versions (versions)) + if (dlg_read_versions (versions, MAX_VERSIONS)) { for (i = 0; versions [i] != NULL; i++) { @@ -101,7 +103,7 @@ } - if (!dlg_read_versions (versions)) + if (!dlg_read_versions (versions, MAX_VERSIONS)) dlg_die (ERR_VERSIONFILE); Index: src/pkg.c =================================================================== --- src/pkg.c (revision 63) +++ src/pkg.c (working copy) @@ -159,34 +159,34 @@ - bool dlg_read_versions (char **versions) + bool dlg_read_versions (char **versions, int max) { - unsigned char tmp[1], buf [512]; - char *t; + char *t, *buf; FILE *fd; - int c = 0, d = 0; + int c = 0; - clean (buf); - - if ((fd = fopen ("versions", "r"))) + if ((fd = fopen("versions", "r"))) { - while (!feof(fd)) + buf = (char *)malloc(512); + while ((!feof(fd)) && (c < max)) { /* read in one line (up to 511 characters + terminating null) */ - if (fgets((char *)buf, 512, fd) != NULL) + if (fgets(buf, 512, fd) != NULL) { - /* look for a newline character and kill it */ - t = strchr((char *)buf, '\n'); + /* look for a newline character and kill it, ignore + * '\r' since this is linux */ + t = strchr(buf, '\n'); if (t) t[0] = 0; /* copy string into version array and clean up */ - versions[c++] = strdup((char *)buf); - clean(buf); + versions[c++] = strdup(buf); } } - versions [c] = NULL; - fclose (fd); + /* At most, c should be equal to max */ + versions[c] = NULL; + fclose(fd); + free(buf); return true; } return false;