Skip to content
Snippets Groups Projects
Commit 18808504 authored by Deucе's avatar Deucе :ok_hand_tone4:
Browse files

Fix a few impossible issues "found" by Coverity.

parent 7adb5251
No related branches found
No related tags found
1 merge request!488Overhaul LZH code
Pipeline #7468 failed
...@@ -1094,13 +1094,13 @@ edit_name(char *itemname, struct bbslist **list, str_list_t inifile, bool edit_t ...@@ -1094,13 +1094,13 @@ edit_name(char *itemname, struct bbslist **list, str_list_t inifile, bool edit_t
uifc.helpbuf = "`Directory Entry Name`\n\n" uifc.helpbuf = "`Directory Entry Name`\n\n"
"Enter the name of the entry as it is to appear in the directory."; "Enter the name of the entry as it is to appear in the directory.";
if (itemname) if (itemname)
strcpy(tmp, itemname); strlcpy(tmp, itemname, sizeof(tmp));
if (uifc.input(WIN_MID | WIN_SAV, 0, 0, "Name", tmp, LIST_NAME_MAX, K_EDIT) == -1) if (uifc.input(WIN_MID | WIN_SAV, 0, 0, "Name", tmp, LIST_NAME_MAX, K_EDIT) == -1)
return false; return false;
check_exit(false); check_exit(false);
if (quitting) if (quitting)
return false; return false;
if ((edit_to_add || stricmp(tmp, itemname)) && list_name_check(list, tmp, NULL, false)) { if ((edit_to_add || (itemname != NULL && stricmp(tmp, itemname))) && list_name_check(list, tmp, NULL, false)) {
uifc.helpbuf = "`Entry Name Already Exists`\n\n" uifc.helpbuf = "`Entry Name Already Exists`\n\n"
"An entry with that name already exists in the directory.\n" "An entry with that name already exists in the directory.\n"
"Please choose a unique name.\n"; "Please choose a unique name.\n";
......
...@@ -271,6 +271,7 @@ modem_connect(struct bbslist *bbs) ...@@ -271,6 +271,7 @@ modem_connect(struct bbslist *bbs)
/* Drain modem output buffer */ /* Drain modem output buffer */
while (comReadByte(com, (uchar*)respbuf)) while (comReadByte(com, (uchar*)respbuf))
; ;
respbuf[0] = 0;
if (!bbs->hidepopups) if (!bbs->hidepopups)
uifc.pop("Initializing..."); uifc.pop("Initializing...");
......
...@@ -3088,8 +3088,8 @@ read_jxl(const char *fn) ...@@ -3088,8 +3088,8 @@ read_jxl(const char *fn)
struct xpmapping *map = xpmap(fn, XPMAP_READ); struct xpmapping *map = xpmap(fn, XPMAP_READ);
struct ciolib_pixels *pret = NULL; struct ciolib_pixels *pret = NULL;
uint8_t *pbuf = NULL; uint8_t *pbuf = NULL;
uintmax_t width; uintmax_t width = 0;
uintmax_t height; uintmax_t height = 0;
if (map == NULL) if (map == NULL)
return map; return map;
...@@ -3151,15 +3151,22 @@ read_jxl(const char *fn) ...@@ -3151,15 +3151,22 @@ read_jxl(const char *fn)
#endif #endif
break; break;
case JXL_DEC_NEED_IMAGE_OUT_BUFFER: case JXL_DEC_NEED_IMAGE_OUT_BUFFER:
if (width == 0 || height == 0 || width >= 0x40000000 || hewight >= 0x40000000) {
done = true;
break;
}
if (Jxl.DecoderImageOutBufferSize(dec, &format, &sz) != JXL_DEC_SUCCESS) { if (Jxl.DecoderImageOutBufferSize(dec, &format, &sz) != JXL_DEC_SUCCESS) {
done = true; done = true;
break; break;
} }
// This may break things, but Coverity wants it.
free(pbuf);
pbuf = malloc(sz); pbuf = malloc(sz);
if (pbuf == NULL) { if (pbuf == NULL) {
done = true; done = true;
break; break;
} }
freepixels(pret);
pret = alloc_ciolib_pixels(width, height); pret = alloc_ciolib_pixels(width, height);
if (pret == NULL) { if (pret == NULL) {
done = true; done = true;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment