diff options
author | Michael K. Johnson <johnsonm@redhat.com> | 1997-09-21 16:03:50 +0000 |
---|---|---|
committer | Michael K. Johnson <johnsonm@redhat.com> | 1997-09-21 16:03:50 +0000 |
commit | 8335c2a63b5204dbab0575f220075af72e59ea04 (patch) | |
tree | 3ce2a39bc4f53797fb9ea5374b7cbb228c6f95df /src | |
parent | 995387d1f852c4301ef0685a91d3df38f4bcdc36 (diff) | |
download | initscripts-8335c2a63b5204dbab0575f220075af72e59ea04.tar initscripts-8335c2a63b5204dbab0575f220075af72e59ea04.tar.gz initscripts-8335c2a63b5204dbab0575f220075af72e59ea04.tar.bz2 initscripts-8335c2a63b5204dbab0575f220075af72e59ea04.tar.xz initscripts-8335c2a63b5204dbab0575f220075af72e59ea04.zip |
Fixed allocation bug Erik found, plus a few stylistic points.
Diffstat (limited to 'src')
-rw-r--r-- | src/usernetctl.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/usernetctl.c b/src/usernetctl.c index 33bdaf1c..f642f332 100644 --- a/src/usernetctl.c +++ b/src/usernetctl.c @@ -134,7 +134,7 @@ int main(int argc, char ** argv) { /* automatically prepend "ifcfg-" if it is not specified */ if (!strncmp(ifaceConfig, "ifcfg-", 6)) { char *temp; - temp = (char *) malloc(strlen(ifaceConfig) + 6); + temp = (char *) alloca(strlen(ifaceConfig) + 7); strcpy(temp, "ifcfg-"); /* strcat is safe because we got the length from strlen */ strcat(temp, ifaceConfig); @@ -143,7 +143,8 @@ int main(int argc, char ** argv) { switch (userCtl(ifaceConfig)) { - char * dash; + char *dash; + case NOT_FOUND: /* a `-' will be found at least in "ifcfg-" */ dash = strrchr(ifaceConfig, '-'); |