diff --git a/src/auth.c b/src/auth.c index 40e7ebe..36ef007 100644 --- a/src/auth.c +++ b/src/auth.c @@ -125,12 +125,10 @@ void moarEnv(char* user, struct session session, struct passwd* pw, size_t newbuf_len = home_len + strlen(file2sourcepath) + 2; char* newbuf = malloc(newbuf_len); // nullbyte and slash if (newbuf == NULL) continue; // can't bother - strlcpy(newbuf, pw->pw_dir, newbuf_len); + memcpy(newbuf, pw->pw_dir, newbuf_len); newbuf[home_len] = '/'; // assume pw_dir doesn't start with '/' :P - strlcpy(&newbuf[home_len + 1], file2sourcepath, - newbuf_len - home_len - 1); + memcpy(&newbuf[home_len + 1], file2sourcepath, newbuf_len - home_len); - /* printf("DEBUG(user_source)!!!! %d %s\n", i, newbuf); */ sourceFileTry(newbuf); free(newbuf); } diff --git a/src/config.c b/src/config.c index c62d7e3..7619804 100644 --- a/src/config.c +++ b/src/config.c @@ -126,7 +126,7 @@ struct parser_error parse_key(enum introspection_type typ, union typ_ptr at, aux_str = strdup(key); if (!aux_str) FAIL("allocation failure"); aux_err = parse_str_inplace(aux_str); - if (aux_err.msg != NULL) { + if (!aux_err.msg) { free(aux_str); return aux_err; } @@ -157,7 +157,7 @@ struct parser_error parse_key(enum introspection_type typ, union typ_ptr at, aux_str = strdup(key); if (!aux_str) FAIL("allocation failure"); aux_err = parse_str_inplace(aux_str); - if (aux_err.msg != NULL) { + if (!aux_err.msg) { free(aux_str); return aux_err; }