vfs: check userland buffers before reading them.
[haiku.git] / src / tests / kits / net / sock / pattern.c
blob614306b105b02f37320029ae40907e750c13974c
1 /* -*- c-basic-offset: 8; -*-
3 * Copyright (c) 1993 W. Richard Stevens. All rights reserved.
4 * Permission to use or modify this software and its documentation only for
5 * educational purposes and without fee is hereby granted, provided that
6 * the above copyright notice appear in all copies. The author makes no
7 * representations about the suitability of this software for any purpose.
8 * It is provided "as is" without express or implied warranty.
9 */
11 #include "sock.h"
12 #include <ctype.h>
14 void
15 pattern(char *ptr, int len)
17 char c;
19 c = 0;
20 while(len-- > 0) {
21 while(isprint((c & 0x7F)) == 0)
22 c++; /* skip over nonprinting characters */
23 *ptr++ = (c++ & 0x7F);