Skip to content

Commit

Permalink
Remove ctype usage
Browse files Browse the repository at this point in the history
The ctype functions are error prone. The argument is an int which must be
in the range of an unsigned char and is interpreted based on the locale:

    These functions check whether c, which must have the value of an
    unsigned char or EOF, falls into a certain character class according
    to the  specified  locale. The  functions without the "_l" suffix
    perform the check based on the current locale.
  • Loading branch information
msantos committed Nov 16, 2023
1 parent 193d90d commit 5d9747d
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 9 deletions.
3 changes: 1 addition & 2 deletions c_src/procket.h
@@ -1,4 +1,4 @@
/* Copyright (c) 2010-2015, Michael Santos <michael.santos@gmail.com>
/* Copyright (c) 2010-2023, Michael Santos <michael.santos@gmail.com>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -58,7 +58,6 @@
#include <sys/ioctl.h>

#include <sys/stat.h>
#include <ctype.h>

#include <sys/uio.h>

Expand Down
7 changes: 0 additions & 7 deletions c_src/procket_cmd.c
Expand Up @@ -202,16 +202,9 @@ int procket_open_fd(PROCKET_STATE *ps) {
}

int procket_check_devname(char *dev, size_t len) {
char *p = NULL;

if (strlen(dev) >= len)
return -1;

for (p = dev; *p; p++) {
if (!isascii(*p) && !isalnum(*p) && *p != '/')
return -1;
}

return 0;
}

Expand Down

0 comments on commit 5d9747d

Please sign in to comment.