mirror of
https://github.com/mauiaaron/apple2.git
synced 2025-01-12 06:29:58 +00:00
Handle unlikely overflow and silence clang warning
This commit is contained in:
parent
cecc78e824
commit
ea71d197e0
@ -92,7 +92,14 @@ const char *def(const char* const src, const int expected_bytecount)
|
||||
}
|
||||
|
||||
if (buflen > 0) {
|
||||
size_t written = gzwrite(gzdest, buf, buflen);
|
||||
unsigned int buflen_ = 0;
|
||||
if (buflen > UINT_MAX) {
|
||||
ERRLOG("OOPS buffer is huge!");
|
||||
break;
|
||||
} else {
|
||||
buflen_ = (unsigned int)buflen;
|
||||
}
|
||||
size_t written = gzwrite(gzdest, buf, buflen_);
|
||||
if (written < buflen) {
|
||||
ERRLOG("OOPS gzwrite ...");
|
||||
break;
|
||||
|
Loading…
x
Reference in New Issue
Block a user