silence 2 more warningsi; fix a potential NULL assignment on the way

This commit is contained in:
marschap
2006-04-14 09:59:54 +00:00
parent e4812666d8
commit 08574b8baa
2 changed files with 9 additions and 4 deletions
+8 -3
View File
@@ -310,9 +310,14 @@ process_command_line(int argc, char **argv)
case 'd':
/* Add to a list of drivers to be initialized later...*/
if (num_drivers < MAX_DRIVERS) {
drivernames[num_drivers] = malloc( strlen(optarg)+1 );
strcpy( drivernames[num_drivers], optarg );
num_drivers ++;
drivernames[num_drivers] = strdup(optarg);
if (drivernames[num_drivers] != NULL) {
num_drivers ++;
}
else {
report(RPT_ERR, "alloc error storing driver name: %s", optarg);
e = -1
}
} else {
report( RPT_ERR, "Too many drivers!" );
e = -1;
+1 -1
View File
@@ -315,7 +315,7 @@ sock_printf_error(int fd, const char *format, .../*args*/ )
va_list ap;
int size = 0;
strcpy(buf, huh);
strncpy(buf, huh, sizeof(huh)); // note: sizeof(huh) < MAXMSG
va_start(ap, format);
size = vsnprintf(buf + (sizeof(huh)-1), sizeof(buf) - (sizeof(huh)-1), format, ap);