static char *
copystring(const char *src)
{
- int len = strlen (src);
+ int len;
char *cp;
if (!src) return NULL;
+
+ len = strlen (src);
cp = malloc (len + 1);
if (cp)
strcpy (cp, src);
prefix (inputfilename, lineno);
fprintf (stderr,
"protodata_hex contains odd number of or non-hex characters\n");
+ free(protodata);
return (1);
}
}
fprintf (stderr,
"authdata_hex contains odd number of or non-hex characters\n");
free (protodata);
+ free (authdata);
return (1);
}
}
isfd = stat(dblong,&statbuf);
if (-1==isfd) {
_tt_syslog(errstr, LOG_ERR, "%s: %m", dblong);
+ free(db);
free(dblong);
return 0;
}
isfd = stat(dblong,&statbuf);
if (-1==isfd) {
_tt_syslog(errstr, LOG_ERR, "%s: %m", dblong);
+ free(db);
free(dblong);
return 0;
}
strncat( resolved_path_buf,
base, MAXPATHLEN - len );
}
+ free(dir);
}
} else {
resolved_path = _tt_get_realpath( (char *)path,
_Tt_string hostname_s;
_Tt_string partition;
_Tt_string network_path;
-
- *hostname = "";
- if (filename==0 || hostname==0) {
+
+ if (filename == NULL || hostname == NULL) {
return TT_ERR_POINTER;
}
filename_s = filename;
}
*len = value.len();
*val = (unsigned char *)_tt_strdup( value, *len );
- if (val == 0) {
+ if (*val == NULL) {
return TT_ERR_NOMEM;
}
return TT_OK;
else
(void) unlink(tmpnam);
+ free(tmpnam);
+
return TT_OK;
}
Tt_status _Tt_auth::
return TT_AUTHFILE_ENTRY_MISSING;
buff = (char*) malloc(entry->auth_data_length + 1);
- if (NULL == buff) return TT_ERR_NOMEM;
+ if (NULL == buff) {
+ _tt_FreeAuthFileEntry(entry);
+ return TT_ERR_NOMEM;
+ }
strncpy(buff, entry->auth_data, entry->auth_data_length);
buff[entry->auth_data_length] = '\0';
{
char namebuf[MAXPATHLEN];
- (void) strcpy(namebuf, isfname);
+ snprintf(namebuf, sizeof(namebuf), "%s", isfname);
_makedat_isfname(namebuf);
(void)unlink(namebuf);
{
char namebuf[MAXPATHLEN];
- (void) strcpy(namebuf, isfname);
+ snprintf(namebuf, sizeof(namebuf), "%s", isfname);
_makeind_isfname(namebuf);
(void)unlink(namebuf);
{
char namebuf[MAXPATHLEN];
- (void) strcpy(namebuf, isfname);
+ snprintf(namebuf, sizeof(namebuf), "%s", isfname);
_makevar_isfname(namebuf);
(void)unlink(namebuf);
* Open the UNIX file for .rec file.
*/
if ((dat_fd = _open_datfile (isfname, &rdonly)) == -1 || errno == EMFILE) {
- _amseterrcode(errcode, errno);
- return (NULL);
+ _amseterrcode(errcode, errno);
+ if(dat_fd != -1) {
+ close(dat_fd);
+ }
+ return (NULL);
}
/*
int fd;
char namebuf[MAXPATHLEN];
- (void) strcpy(namebuf, isfname);
+ snprintf(namebuf, sizeof(namebuf), "%s", isfname);
_makedat_isfname(namebuf);
fd = open (namebuf, O_CREAT | O_EXCL | O_RDWR, 0666);
int fd;
char namebuf[MAXPATHLEN];
- (void) strcpy(namebuf, isfname);
+ snprintf(namebuf, sizeof(namebuf), "%s", isfname);
_makeind_isfname(namebuf);
fd = open (namebuf, O_CREAT | O_EXCL | O_RDWR, 0666);
int fd;
char namebuf[MAXPATHLEN];
- (void) strcpy(namebuf, isfname);
+ snprintf(namebuf, sizeof(namebuf), "%s", isfname);
_makevar_isfname(namebuf);
fd = open (namebuf, O_CREAT | O_EXCL | O_RDWR, 0666);
{
char namebuf[MAXPATHLEN];
- (void) strcpy(namebuf, isfname);
+ snprintf(namebuf, sizeof(namebuf), "%s", isfname);
_makedat_isfname(namebuf);
(void) unlink(namebuf);
{
char namebuf[MAXPATHLEN];
- (void) strcpy(namebuf, isfname);
+ snprintf(namebuf, sizeof(namebuf), "%s", isfname);
_makeind_isfname(namebuf);
(void) unlink(namebuf);
{
char namebuf[MAXPATHLEN];
- (void) strcpy(namebuf, isfname);
+ snprintf(namebuf, sizeof(namebuf), "%s", isfname);
_makevar_isfname(namebuf);
(void) unlink(namebuf);
char namebuf[MAXPATHLEN];
int ret;
- (void) strcpy(namebuf, isfname);
+ snprintf(namebuf, sizeof(namebuf), "%s", isfname);
_makedat_isfname(namebuf);
if ((ret = open (namebuf, O_RDWR)) != -1) {
int fd;
char namebuf[MAXPATHLEN];
- (void) strcpy(namebuf, isfname);
+ snprintf(namebuf, sizeof(namebuf), "%s", isfname);
_makeind_isfname(namebuf);
fd = open (namebuf, (rdonly==TRUE)?O_RDONLY:O_RDWR);
int fd;
char namebuf[MAXPATHLEN];
- (void) strcpy(namebuf, isfname);
+ snprintf(namebuf, sizeof(namebuf), "%s", isfname);
_makevar_isfname(namebuf);
fd = open (namebuf, (rdonly==TRUE)?O_RDONLY:O_RDWR);
if (fcb->indfd != -1)
return (ISOK);
- (void) strcpy(namebuf, fcb->isfname);
+ snprintf(namebuf, sizeof(namebuf), "%s", fcb->isfname);
_makeind_isfname(namebuf);
(void)fstat(fcb->datfd, &buf);
struct stat statbuf;
int count = 0,i;
- (void)strcpy(isfname2, isfname);
- (void)strcat(isfname2, "~");
+ snprintf(isfname2, sizeof(isfname2), "%s~", isfname);
if ((isfd = isopen(isfname, ISEXCLLOCK + ISINPUT)) == ISERROR) {
goto ERROR;
* still thinks that the file exists for a few seconds.
*/
- (void)strcpy(datfname, oldname);
+ snprintf(datfname, sizeof(datfname), "%s", oldname);
_makedat_isfname(datfname);
(void)unlink(datfname);
char namebuf[MAXPATHLEN];
char newbuf[MAXPATHLEN];
- (void) strcpy(namebuf, isfname);
- (void) strcpy(newbuf, isfname);
+ snprintf(namebuf, sizeof(namebuf), "%s", isfname);
+ snprintf(newbuf, sizeof(newbuf), "%s", isfname);
/*
* Replace the last element of the old path with newname.
*/
_removelast(newbuf);
if (strcmp(newbuf, "/") != 0)
- (void) strcat(newbuf, "/");
- (void)strcat(newbuf, newname);
+ snprintf(newbuf, sizeof(newbuf), "%s/", newbuf);
+ snprintf(newbuf, sizeof(newbuf), "%s%s", newbuf, newname);
_makedat_isfname(namebuf);
_makedat_isfname(newbuf);
char namebuf[MAXPATHLEN];
char newbuf[MAXPATHLEN];
- (void) strcpy(namebuf, isfname);
- (void) strcpy(newbuf, isfname);
+ snprintf(namebuf, sizeof(namebuf), "%s", isfname);
+ snprintf(newbuf, sizeof(newbuf), "%s", isfname);
/*
* Replace the last element of the old path with newname.
*/
_removelast(newbuf);
if (strcmp(newbuf, "/") != 0)
- (void) strcat(newbuf, "/");
- (void)strcat(newbuf, newname);
+ snprintf(newbuf, sizeof(newbuf), "%s/", newbuf);
+ snprintf(newbuf, sizeof(newbuf), "%s%s", newbuf, newname);
_makeind_isfname(namebuf);
_makeind_isfname(newbuf);
char namebuf[MAXPATHLEN];
char newbuf[MAXPATHLEN];
- (void) strcpy(namebuf, isfname);
- (void) strcpy(newbuf, isfname);
+ snprintf(namebuf, sizeof(namebuf), "%s", isfname);
+ snprintf(newbuf, sizeof(newbuf), "%s", isfname);
/*
* Replace the last element of the old path with newname.
*/
_removelast(newbuf);
if (strcmp(newbuf, "/") != 0)
- (void) strcat(newbuf, "/");
- (void)strcat(newbuf, newname);
+ snprintf(newbuf, sizeof(newbuf), "%s/", newbuf);
+ snprintf(newbuf, sizeof(newbuf), "%s%s", newbuf, newname);
_makevar_isfname(namebuf);
_makevar_isfname(newbuf);
_amseterrcode(errcode, ISOK);
/* Clean-up work. */
- if (newcrp != NULL)
- free(newcrp);
+ free(newcrp);
_isdisk_commit(); /* This will only check
* that we unfixed all fixed