diff options
author | Jakob Kaivo <jkk@ung.org> | 2020-10-06 12:30:39 -0400 |
---|---|---|
committer | Jakob Kaivo <jkk@ung.org> | 2020-10-06 12:30:39 -0400 |
commit | 036b8429a243a42918d27eaa4716f444a44e613f (patch) | |
tree | 740425185233ae90cc84795b9f99ceb5f015877f | |
parent | 53c07bba59cf7e0c3ecfd2cbb66208b86889006d (diff) |
-rw-r--r-- | ipcrm.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -58,11 +58,12 @@ static struct ipcrm *ipcrm_q(ipc_type type, const char *id, struct ipcrm *head) errno = 0; char *end = NULL; - add->id = strtol(id, &end, 0); - if ((end && *end) || (add->id == LONG_MAX && errno) || (add->id < 0)) { + long l = strtol(id, &end, 0); + if ((end && *end) || (l > INT_MAX) || (l < 0)) { fprintf(stderr, "ipcrm: %s: %s\n", id, strerror(EINVAL)); return NULL; } + add->id = l; if (type == MSGKEY) { add->id = msgget(add->id, 0); |