174 lines
3.6 KiB
HTML
174 lines
3.6 KiB
HTML
<HTML
|
|
><HEAD
|
|
><TITLE
|
|
>Call Only Safe Library Routines</TITLE
|
|
><META
|
|
NAME="GENERATOR"
|
|
CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK
|
|
REL="HOME"
|
|
TITLE="Secure Programming for Linux and Unix HOWTO"
|
|
HREF="index.html"><LINK
|
|
REL="UP"
|
|
TITLE="Carefully Call Out to Other Resources"
|
|
HREF="call-out.html"><LINK
|
|
REL="PREVIOUS"
|
|
TITLE="Carefully Call Out to Other Resources"
|
|
HREF="call-out.html"><LINK
|
|
REL="NEXT"
|
|
TITLE="Limit Call-outs to Valid Values"
|
|
HREF="limit-call-outs.html"></HEAD
|
|
><BODY
|
|
CLASS="SECT1"
|
|
BGCOLOR="#FFFFFF"
|
|
TEXT="#000000"
|
|
LINK="#0000FF"
|
|
VLINK="#840084"
|
|
ALINK="#0000FF"
|
|
><DIV
|
|
CLASS="NAVHEADER"
|
|
><TABLE
|
|
SUMMARY="Header navigation table"
|
|
WIDTH="100%"
|
|
BORDER="0"
|
|
CELLPADDING="0"
|
|
CELLSPACING="0"
|
|
><TR
|
|
><TH
|
|
COLSPAN="3"
|
|
ALIGN="center"
|
|
>Secure Programming for Linux and Unix HOWTO</TH
|
|
></TR
|
|
><TR
|
|
><TD
|
|
WIDTH="10%"
|
|
ALIGN="left"
|
|
VALIGN="bottom"
|
|
><A
|
|
HREF="call-out.html"
|
|
ACCESSKEY="P"
|
|
>Prev</A
|
|
></TD
|
|
><TD
|
|
WIDTH="80%"
|
|
ALIGN="center"
|
|
VALIGN="bottom"
|
|
>Chapter 8. Carefully Call Out to Other Resources</TD
|
|
><TD
|
|
WIDTH="10%"
|
|
ALIGN="right"
|
|
VALIGN="bottom"
|
|
><A
|
|
HREF="limit-call-outs.html"
|
|
ACCESSKEY="N"
|
|
>Next</A
|
|
></TD
|
|
></TR
|
|
></TABLE
|
|
><HR
|
|
ALIGN="LEFT"
|
|
WIDTH="100%"></DIV
|
|
><DIV
|
|
CLASS="SECT1"
|
|
><H1
|
|
CLASS="SECT1"
|
|
><A
|
|
NAME="CALL-ONLY-SAFE"
|
|
></A
|
|
>8.1. Call Only Safe Library Routines</H1
|
|
><P
|
|
>Sometimes there is a conflict between security and the development
|
|
principles of abstraction (information hiding) and reuse.
|
|
The problem is that some high-level library routines
|
|
may or may not be implemented securely,
|
|
and their specifications won't tell you.
|
|
Even if a particular implementation is secure, it may not be
|
|
possible to ensure that other versions of the routine
|
|
will be safe, or that the same interface will be safe on other platforms. </P
|
|
><P
|
|
>In the end, if your application must be secure, you must sometimes
|
|
re-implement your own versions of library routines.
|
|
Basically, you have to re-implement routines if you can't be sure
|
|
that the library routines will perform the necessary actions you require
|
|
for security.
|
|
Yes, in some cases the library's implementation should be fixed, but
|
|
it's your users who will be hurt if you choose a library routine that
|
|
is a security weakness.
|
|
If can, try to use the high-level interfaces when you must
|
|
re-implement something - that way, you can switch to the high-level
|
|
interface on systems where its use is secure.</P
|
|
><P
|
|
>If you can, test to see if the routine is secure or not, and use it if
|
|
it's secure - ideally you can perform this test as part of
|
|
compilation or installation (e.g., as part of an ``autoconf'' script).
|
|
For some conditions this kind of run-time testing is impractical, but
|
|
for other conditions, this can eliminate many problems.
|
|
If you don't want to bother to re-implement the library, at least test
|
|
to make sure it's safe and halt installation if it isn't.
|
|
That way, users will not accidentally install an insecure program and
|
|
will know what the problem is.</P
|
|
></DIV
|
|
><DIV
|
|
CLASS="NAVFOOTER"
|
|
><HR
|
|
ALIGN="LEFT"
|
|
WIDTH="100%"><TABLE
|
|
SUMMARY="Footer navigation table"
|
|
WIDTH="100%"
|
|
BORDER="0"
|
|
CELLPADDING="0"
|
|
CELLSPACING="0"
|
|
><TR
|
|
><TD
|
|
WIDTH="33%"
|
|
ALIGN="left"
|
|
VALIGN="top"
|
|
><A
|
|
HREF="call-out.html"
|
|
ACCESSKEY="P"
|
|
>Prev</A
|
|
></TD
|
|
><TD
|
|
WIDTH="34%"
|
|
ALIGN="center"
|
|
VALIGN="top"
|
|
><A
|
|
HREF="index.html"
|
|
ACCESSKEY="H"
|
|
>Home</A
|
|
></TD
|
|
><TD
|
|
WIDTH="33%"
|
|
ALIGN="right"
|
|
VALIGN="top"
|
|
><A
|
|
HREF="limit-call-outs.html"
|
|
ACCESSKEY="N"
|
|
>Next</A
|
|
></TD
|
|
></TR
|
|
><TR
|
|
><TD
|
|
WIDTH="33%"
|
|
ALIGN="left"
|
|
VALIGN="top"
|
|
>Carefully Call Out to Other Resources</TD
|
|
><TD
|
|
WIDTH="34%"
|
|
ALIGN="center"
|
|
VALIGN="top"
|
|
><A
|
|
HREF="call-out.html"
|
|
ACCESSKEY="U"
|
|
>Up</A
|
|
></TD
|
|
><TD
|
|
WIDTH="33%"
|
|
ALIGN="right"
|
|
VALIGN="top"
|
|
>Limit Call-outs to Valid Values</TD
|
|
></TR
|
|
></TABLE
|
|
></DIV
|
|
></BODY
|
|
></HTML
|
|
> |