File: | FSOpenFont.c |
Location: | line 75, column 5 |
Description: | Null pointer passed as an argument to a 'nonnull' parameter |
1 | /* | ||
2 | * Copyright 1990 Network Computing Devices; | ||
3 | * Portions Copyright 1987 by Digital Equipment Corporation | ||
4 | * | ||
5 | * Permission to use, copy, modify, distribute, and sell this software | ||
6 | * and its documentation for any purpose is hereby granted without fee, | ||
7 | * provided that the above copyright notice appear in all copies and | ||
8 | * that both that copyright notice and this permission notice appear | ||
9 | * in supporting documentation, and that the names of Network Computing | ||
10 | * Devices or Digital not be used in advertising or publicity pertaining | ||
11 | * to distribution of the software without specific, written prior | ||
12 | * permission. Network Computing Devices or Digital make no representations | ||
13 | * about the suitability of this software for any purpose. It is provided | ||
14 | * "as is" without express or implied warranty. | ||
15 | * | ||
16 | * NETWORK COMPUTING DEVICES AND DIGITAL DISCLAIM ALL WARRANTIES WITH | ||
17 | * REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF | ||
18 | * MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL NETWORK COMPUTING DEVICES | ||
19 | * OR DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES | ||
20 | * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, | ||
21 | * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, | ||
22 | * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS | ||
23 | * SOFTWARE. | ||
24 | */ | ||
25 | |||
26 | /* | ||
27 | |||
28 | Copyright 1987, 1994, 1998 The Open Group | ||
29 | |||
30 | Permission to use, copy, modify, distribute, and sell this software and its | ||
31 | documentation for any purpose is hereby granted without fee, provided that | ||
32 | the above copyright notice appear in all copies and that both that | ||
33 | copyright notice and this permission notice appear in supporting | ||
34 | documentation. | ||
35 | |||
36 | The above copyright notice and this permission notice shall be included in | ||
37 | all copies or substantial portions of the Software. | ||
38 | |||
39 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
40 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
41 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
42 | OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN | ||
43 | AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
44 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
45 | |||
46 | Except as contained in this notice, the name of The Open Group shall not be | ||
47 | used in advertising or otherwise to promote the sale, use or other dealings | ||
48 | in this Software without prior written authorization from The Open Group. | ||
49 | |||
50 | */ | ||
51 | |||
52 | #ifdef HAVE_CONFIG_H1 | ||
53 | #include <config.h> | ||
54 | #endif | ||
55 | #include "FSlibint.h" | ||
56 | |||
57 | Font | ||
58 | FSOpenBitmapFont( | ||
59 | FSServer *svr, | ||
60 | FSBitmapFormat hint, | ||
61 | FSBitmapFormatMask fmask, | ||
62 | char *name, | ||
63 | Font *otherid) | ||
64 | { | ||
65 | unsigned int nbytes; | ||
66 | fsOpenBitmapFontReq *req; | ||
67 | fsOpenBitmapFontReply reply; | ||
68 | Font fid; | ||
69 | char buf[256]; | ||
70 | |||
71 | nbytes = name ? strlen(name) : 0; | ||
| |||
| |||
72 | if (nbytes > 255) return 0; | ||
| |||
73 | GetReq(OpenBitmapFont, req)if ((svr->bufptr + 16) > svr->bufmax) _FSFlush(svr); req = (fsOpenBitmapFontReq *)(svr->last_req = svr->bufptr ); req->reqType = 15; req->length = (16)>>2; svr-> bufptr += 16; svr->request++; | ||
74 | buf[0] = nbytes; | ||
75 | memcpy(&buf[1], name, nbytes); | ||
| |||
76 | nbytes++; | ||
77 | req->fid = fid = svr->resource_id++; | ||
78 | req->format_hint = hint; | ||
79 | req->format_mask = fmask; | ||
80 | req->length += (nbytes + 3) >> 2; | ||
81 | _FSSend(svr, buf, (long) nbytes); | ||
82 | if (!_FSReply(svr, (fsReply *) & reply, | ||
83 | (SIZEOF(fsOpenBitmapFontReply)16-SIZEOF(fsGenericReply)8) >> 2, | ||
84 | fsFalse0)) | ||
85 | return 0; | ||
86 | *otherid = reply.otherid; | ||
87 | SyncHandle()if (svr->synchandler) (*svr->synchandler)(svr); | ||
88 | return fid; | ||
89 | } |