sscanf(line, "%hu", &old_cluster.port);
if (lineno == LOCK_FILE_LINE_SOCKET_DIR)
{
- cluster->sockdir = pg_malloc(MAXPGPATH);
+ cluster->sockdir = pg_strdup(line);
/* strip off newline */
- sscanf(line, "%s\n", cluster->sockdir);
+ if (strchr(cluster->sockdir, '\n') != NULL)
+ *strchr(cluster->sockdir, '\n') = '\0';
}
}
fclose(fp);
char fname[MAXPGPATH];
char path[MAXPGPATH];
+ /* Can't overflow because line and fname are the same length. */
if (sscanf(line, "%u %s\n", &oid, fname) != 2)
exit_horribly(modulename, "invalid line in large object TOC file \"%s\": \"%s\"\n",
fname, line);