1 | /* |
1 | /* |
2 | * This file is part of Deliantra, the Roguelike Realtime MMORPG. |
2 | * This file is part of Deliantra, the Roguelike Realtime MMORPG. |
3 | * |
3 | * |
4 | * Copyright (©) 2005,2006,2007,2008,2009,2010,2011,2012 Marc Alexander Lehmann / Robin Redeker / the Deliantra team |
4 | * Copyright (©) 2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015,2016 Marc Alexander Lehmann / Robin Redeker / the Deliantra team |
5 | * |
5 | * |
6 | * Deliantra is free software: you can redistribute it and/or modify it under |
6 | * Deliantra is free software: you can redistribute it and/or modify it under |
7 | * the terms of the Affero GNU General Public License as published by the |
7 | * the terms of the Affero GNU General Public License as published by the |
8 | * Free Software Foundation, either version 3 of the License, or (at your |
8 | * Free Software Foundation, either version 3 of the License, or (at your |
9 | * option) any later version. |
9 | * option) any later version. |
… | |
… | |
63 | /******************************************************************************/ |
63 | /******************************************************************************/ |
64 | |
64 | |
65 | /* Checks a player-provided string which will become the msg property of |
65 | /* Checks a player-provided string which will become the msg property of |
66 | * an object for dangerous input. |
66 | * an object for dangerous input. |
67 | */ |
67 | */ |
68 | bool |
68 | bool |
69 | msg_is_safe (const char *msg) |
69 | msg_is_safe (const char *msg) |
70 | { |
70 | { |
71 | bool safe = true; |
71 | bool safe = true; |
72 | |
72 | |
73 | /* Trying to cheat by getting data into the object */ |
73 | /* Trying to cheat by getting data into the object */ |
… | |
… | |
130 | |
130 | |
131 | LOG (llevError, "fork abort: %s\n", msg); |
131 | LOG (llevError, "fork abort: %s\n", msg); |
132 | } |
132 | } |
133 | |
133 | |
134 | void * |
134 | void * |
135 | salloc_ (int n) throw (std::bad_alloc) |
135 | salloc_ (int n) |
136 | { |
136 | { |
137 | void *ptr = g_slice_alloc (n); |
137 | void *ptr = g_slice_alloc (n); |
138 | |
138 | |
139 | if (!ptr) |
139 | if (!ptr) |
140 | throw std::bad_alloc (); |
140 | throw std::bad_alloc (); |
… | |
… | |
142 | slice_alloc += n; |
142 | slice_alloc += n; |
143 | return ptr; |
143 | return ptr; |
144 | } |
144 | } |
145 | |
145 | |
146 | void * |
146 | void * |
147 | salloc_ (int n, void *src) throw (std::bad_alloc) |
147 | salloc_ (int n, void *src) |
148 | { |
148 | { |
149 | void *ptr = salloc_ (n); |
149 | void *ptr = salloc_ (n); |
150 | |
150 | |
151 | if (src) |
151 | if (src) |
152 | memcpy (ptr, src, n); |
152 | memcpy (ptr, src, n); |