J
jacob navia
A function like strcpy takes now, two unbounded pointers.
Unbounded pointers, i.e. pointers where there is no
range information, have catastrophic failure modes
specially when *writing* to main memory.
A better string library would accept *bounded* pointers.
We would have then:
char *strcpyN(char *destination, size_t bound1,
char *src,size_t bound2);
Bounded pointers are used in C in many interfaces.
This is absolutely nothing new.
Their use could be made more generalized when the
functions in the C library would leave the obsession
with unbounded pointers and accept this type too.
Of course, clever compilers could pass automatically
size information to the called function, but that would
be just an improvement. What is needed is a standard
that would allow generalized use of this type of
pointers in applications that need them.
Because in many applications security is more
important than sparing a few cycles.
Of course there exist many string libraries that do
this, but each has its own syntax. Much better
would be if standard C would encourage the use
of bounded pointers with a string library
that uses them.
jacob
Unbounded pointers, i.e. pointers where there is no
range information, have catastrophic failure modes
specially when *writing* to main memory.
A better string library would accept *bounded* pointers.
We would have then:
char *strcpyN(char *destination, size_t bound1,
char *src,size_t bound2);
Bounded pointers are used in C in many interfaces.
This is absolutely nothing new.
Their use could be made more generalized when the
functions in the C library would leave the obsession
with unbounded pointers and accept this type too.
Of course, clever compilers could pass automatically
size information to the called function, but that would
be just an improvement. What is needed is a standard
that would allow generalized use of this type of
pointers in applications that need them.
Because in many applications security is more
important than sparing a few cycles.
Of course there exist many string libraries that do
this, but each has its own syntax. Much better
would be if standard C would encourage the use
of bounded pointers with a string library
that uses them.
jacob