Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F145671309
D24599.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
943 B
Referenced Files
None
Subscribers
None
D24599.diff
View Options
Index: head/bin/sh/memalloc.c
===================================================================
--- head/bin/sh/memalloc.c
+++ head/bin/sh/memalloc.c
@@ -50,6 +50,13 @@
#include <stdlib.h>
#include <unistd.h>
+static void
+badalloc(const char *message)
+{
+ write(2, message, strlen(message));
+ abort();
+}
+
/*
* Like malloc, but returns an error when out of space.
*/
@@ -59,9 +66,9 @@
{
pointer p;
- INTOFF;
+ if (!is_int_on())
+ badalloc("Unsafe ckmalloc() call\n");
p = malloc(nbytes);
- INTON;
if (p == NULL)
error("Out of space");
return p;
@@ -75,9 +82,9 @@
pointer
ckrealloc(pointer p, int nbytes)
{
- INTOFF;
+ if (!is_int_on())
+ badalloc("Unsafe ckrealloc() call\n");
p = realloc(p, nbytes);
- INTON;
if (p == NULL)
error("Out of space");
return p;
@@ -86,9 +93,9 @@
void
ckfree(pointer p)
{
- INTOFF;
+ if (!is_int_on())
+ badalloc("Unsafe ckfree() call\n");
free(p);
- INTON;
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Feb 23, 10:41 PM (17 h, 44 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28964365
Default Alt Text
D24599.diff (943 B)
Attached To
Mode
D24599: sh: Assert INTOFF rather than applying it in ck*
Attached
Detach File
Event Timeline
Log In to Comment