do not hardcode sizes
This patch will fix the following warning I received from gcc: > nyancat.c: In function ‘main’: > nyancat.c:497: warning: comparison is always true due to limited range of data type * src/nyancat.c: adjust the size of the array and update the references to its size
This commit is contained in:
parent
afc4d6e25e
commit
fd6b3c6de2
@ -483,7 +483,7 @@ int main(int argc, char ** argv) {
|
|||||||
/* Begin Extended Option Mode */
|
/* Begin Extended Option Mode */
|
||||||
sb_mode = 1;
|
sb_mode = 1;
|
||||||
sb_len = 0;
|
sb_len = 0;
|
||||||
memset(sb, 0, 1024);
|
memset(sb, 0, sizeof(sb));
|
||||||
break;
|
break;
|
||||||
case IAC:
|
case IAC:
|
||||||
/* IAC IAC? That's probably not right. */
|
/* IAC IAC? That's probably not right. */
|
||||||
@ -494,7 +494,7 @@ int main(int argc, char ** argv) {
|
|||||||
}
|
}
|
||||||
} else if (sb_mode) {
|
} else if (sb_mode) {
|
||||||
/* Extended Option Mode -> Accept character */
|
/* Extended Option Mode -> Accept character */
|
||||||
if (sb_len < 1023) {
|
if (sb_len < sizeof(sb) - 1) {
|
||||||
/* Append this character to the SB string,
|
/* Append this character to the SB string,
|
||||||
* but only if it doesn't put us over
|
* but only if it doesn't put us over
|
||||||
* our limit; honestly, we shouldn't hit
|
* our limit; honestly, we shouldn't hit
|
||||||
|
Loading…
Reference in New Issue
Block a user