aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Czigler <37268479+mcpcpc@users.noreply.github.com>2020-09-25 12:20:51 -0400
committerGitHub <noreply@github.com>2020-09-25 12:20:51 -0400
commit2056872538445e324a0d690b30cedd29d4c4fee3 (patch)
tree9b50b663609bb6e4012d3cd179f8806d1951a2cb
parentMerge pull request #34 from mcpcpc/add_privmsg_alias (diff)
parentadd check for fgets value (diff)
downloadkirc-2056872538445e324a0d690b30cedd29d4c4fee3.tar.gz
kirc-2056872538445e324a0d690b30cedd29d4c4fee3.tar.bz2
kirc-2056872538445e324a0d690b30cedd29d4c4fee3.tar.xz
kirc-2056872538445e324a0d690b30cedd29d4c4fee3.tar.zst
kirc-2056872538445e324a0d690b30cedd29d4c4fee3.zip
Merge pull request #36 from mcpcpc/fgets
add check for fgets value
-rw-r--r--kirc.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/kirc.c b/kirc.c
index 7c9857d..5445526 100644
--- a/kirc.c
+++ b/kirc.c
@@ -231,7 +231,10 @@ handle_user_input(void) {
char usrin[MSG_MAX], *tok;
- fgets(usrin, MSG_MAX, stdin);
+ if (fgets(usrin, MSG_MAX, stdin) == NULL) {
+ perror("fgets");
+ exit(1);
+ }
size_t msg_len = strlen(usrin);
if (usrin[msg_len - 1] == '\n') {