add codeql fixes/suppressions (#664)
This commit is contained in:
parent
e46452f647
commit
ff62288f8e
|
@ -383,7 +383,7 @@ start:
|
||||||
/*
|
/*
|
||||||
* If we have "-" do nothing, if "--" we are done.
|
* If we have "-" do nothing, if "--" we are done.
|
||||||
*/
|
*/
|
||||||
if (place[1] != '\0' && *++place == '-' && place[1] == '\0') {
|
if (place[1] != '\0' && *++place == '-' && place[1] == '\0') { // CodeQL [SM01947]: upstream code; place re-assigned in previous line
|
||||||
optind++;
|
optind++;
|
||||||
place = EMSG;
|
place = EMSG;
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -159,7 +159,7 @@ main(int argc, char **argv)
|
||||||
/* Handle systems without __progname */
|
/* Handle systems without __progname */
|
||||||
if (__progname == NULL) {
|
if (__progname == NULL) {
|
||||||
__progname = strrchr(argv[0], '/');
|
__progname = strrchr(argv[0], '/');
|
||||||
if (__progname == NULL || (__progname[0] != '\0' && __progname[1] == '\0')) // fix CodeQL SM01947
|
if (__progname == NULL || (__progname[0] != '\0' && __progname[1] == '\0')) // CodeQL [SM01947]: __progname may be longer than 1 byte and prev. checks handle if smaller
|
||||||
__progname = argv[0];
|
__progname = argv[0];
|
||||||
else
|
else
|
||||||
__progname++;
|
__progname++;
|
||||||
|
@ -423,7 +423,7 @@ tohex(const void *_s, size_t l)
|
||||||
r[j++] = hex[(s[i] >> 4) & 0xf]; // CodeQL [SM02311]: tests rely on assert for NULL checks
|
r[j++] = hex[(s[i] >> 4) & 0xf]; // CodeQL [SM02311]: tests rely on assert for NULL checks
|
||||||
r[j++] = hex[s[i] & 0xf];
|
r[j++] = hex[s[i] & 0xf];
|
||||||
}
|
}
|
||||||
r[j] = '\0';
|
r[j] = '\0'; // CodeQL [SM02311]: tests rely on assert for NULL checks
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,6 +35,8 @@ dup_str(char *inStr)
|
||||||
|
|
||||||
int len = strlen(inStr);
|
int len = strlen(inStr);
|
||||||
char *outStr = malloc(len + 1);
|
char *outStr = malloc(len + 1);
|
||||||
|
if (NULL == outStr)
|
||||||
|
return NULL;
|
||||||
strncpy(outStr, inStr, len);
|
strncpy(outStr, inStr, len);
|
||||||
outStr[len] = '\0';
|
outStr[len] = '\0';
|
||||||
return outStr;
|
return outStr;
|
||||||
|
|
Loading…
Reference in New Issue